some optimizations of get next action