task2 final logic fixes