more functions to query database