now able to detect boundary