improvements to the algorithm, much to do