More improvements and corrections to templates