TASK-3 abstract out the function