Serializer improvements

Started as a small refactor and ended up being an internal re-write