Changed function according to the task