Full implementation of task set 2