changing the way to get pwd and adding a function to choose the right trac as a parameter