split into macros and functions
new macros for easy extension definition (the extensions are correctly defined now)