Check in major refactoring to support JSON and update Measurement
Service