Library rewritten using modern techniques, demo project updated