Replaced writeRawArrayField with generic writeField.
Added tests for raw fields