Uncommented code for final result.