refactoring; ER diagram added