C edition

Fixed bugs. Now it works very fast :-)