refectoring and add serializer