properly implemented the optional 'opts'