refactors models into separate files and add database.py