add functions to query and save in database
add timer functions for response time
tidying