Refactored file reading and finished database creation.