Never done a github review before so I'm not sure how comments and new modifications interact, but here's the cleaned up path checking I mentioned in the other comment