refactor_hal_serializer

@fosdev frankly speaking not much to refactor.