implemented functionality for database