Refactor a bit, and gzip the database