Database error log

This pull request achieves the goal of making the output of `database.hs` easier to read.

I was getting annoyed with not knowing when database insertion would complete, so I decided to sort the directory contents before working on them.
@david-yz-liu I made some changes. Is that what you were referring to?