update to algorithm