Refactor to remove opts and logger from global