Formatted template.
Improved key names in data.
Return state as json.
Clear stuff in new state.