onilne algorithm modified proof, different approach