Cleaned and commented code and tests for database populator.