Fixed device-dependent bug in gyro reading, tweaked circle detection

Also cleaned up a few things.