Remove ergregious use of dirname