Get rid of dirname call