simplify mouse code a little