This doesn't seem to be right, global.mapchanging is set to true in this block which would be redundand.