It now reads both stdin and the database