added dir argument