minor adjustments to boundry detection