Began refactoring
Migrated to postgres