Updated database schema

Added foreign key relations & fixed pep8 errors