added functionality for middle and right mouse clicks