Optimization of pointer movements