change to algorithm