refactored to remove duplication
Allows user to delete a task