Updated to use an option object
Updated to include directory parsing