rework the code