completed update and insert functionalities