page templates, cleanup in functions