Keeping marchingsquares algorithm in sync