Implemented database layer