finish implementation of  updating & deleting function for database