Removed the loop and handled IndexError to raise NotFoundError if it occurs