added code for maximum path sum