x_end rework