Improved task 2 B output