changed database,add and delete function