Simplify mouse code