This version is ready to test. Done with Vladimir Glazachev.