More tweaks to mouse movement. Rounded distance is used to check if cursor needs to be moved.