Improve prototype boundaries detection