Tweaked state machine so we prevent repeated calls to getlocation.