refactor to make testing the database calls easier