Added functionality to prevent dragging backwards