added query model for accessing the database