wandering algorithm done