trying function factories, seems to work fine
All simple functions and macros added