finishing helper functions for db