Fix middle mouse btn behavior & small code fixes.