Refactoring to support the options.base setting