updating database and retrieving data from server