Some cleanup in templates