I was hesitant to add another include. it's probably better to use that. Converted to use dirname().  Had to move it last because dirname() tramples on string passed to it.