Simplify naming macros to functions

Change the macros to functions and simplify where possible.