added delete in DB and refactoring