convert pathname code from switch to an if, as there are only two cases.