Lines 57 to 61 can be replaced by

    edit(check, u)