Find path with sum refactor