moved pwd to separate function