refactored code for options.require