styling and cleanup of templates