Made the script take a user-provided dir.