Fixed a bug in the stream unmarshaller and did some minor refactoring here and there.