Basic mouse drag support. Clean up the code a bit.