improve performance by adding a sentinel