Removed unused code, fixed mouse capture mode