Database implementation

Database is created but not completed, have to be tested.