Fix broken math, and make mouse movement more controlled