Some changes to the way quake is run, and the logic of the code