Fixed middle mouse and some fixes for sorting