shouldn't this check go up with the other checks, before looking inside the path? I kinda feel that this method needs to be rewritten, it's more complicated than I wanted it to be.