0.2: move all template logic to LAYOUT namespace