Original C sources provided by Sebastian Voecking and Ferenc Glueck