Updated database schema , added foreign key relations  & fixed pep8 errors 

Edits according to database schema

![image00](https://f.cloud.github.com/assets/934032/2502905/860fbed2-b37c-11e3-8a40-7eed61d8be75.png)