Add new templates and small fixes in the compiler