Extract adding task into seperate function