more updates to algorithm