Some fixes have been applied and the code passes a greater number of unit tests now.