Changed implementation to use SerializableMatrix