Cleaned up serializer logic.