added delete function and database now only select entries with flag = 0 means not deleted