small tidyup of serializer to help with complexity analysis