update to algorithm and setup