good idea. I pulled it out into a method named isValidPath