refctored some code (serializer)