Fixed JSON parsing problems. Added additional integration tests.