Remove unused fields and cleanup template some.