Refactor out path stuff in to separate source and test file