update code, add auto next method