Add dir functions which work slightly better