working on database
major refactoring on database