Refactored the add task