refactored the controllers and added a delete button