small refactor and not modifying opts that are passed in