max path almost done, need to add corner case handling