deviate cursor function added and refined