Added functionality for middle-click event