clean up usage of macros and recursion