Added endpoint detection