Tidying.

Move Parameter out into its own class.

Extract the writing logic from the processing logic.

Change-Id: Ide8342e5dbb4a4581fd25130bd576708e6afe4be