working with correct exit and entrance detection