added shouldEnd boolean