Simplifying very similar impl with macros.