added select next function