cleaned up code for translating paths.