Made directory an mandatory argument
refactor: less identation ifs
refactor: less identation ifs