separated helper functions from database definitions