implemented necessary functions for communication with DB