Added template file and a lot of macros