added query method to db