Refactors: template check and logging logic
Refractors ast: * function declaration is no longer a statement * function body is no longer a block