Update function

Updating function has been connected to DB and tested