refactored around boilerplate. Added opts.load