move stderr/out fns to opts object