re-write x_solver