Refactor add task feature