The algorithm is working so far. Moreover I cleaned up the program code and added missing examples.