Adding functionality for completeTask()