refactor away some of the __dirname