cleaning up code with macros