change the way we find border, very naive function