update_x function created