Ported some scrollwheel code to the vanilla version