- Add some null checks and extract all of the nasty path stuff into its own method