Made some changes to the identify boundary function