Added mouse control

Also formatted code