Review tree max path sum problem and improve the program for better readability.