s3: Turn two macros into functions