refining of online algo, subscripts replaced