The first stable version of the algorithms. Work in progress...