The implementation tested in my paper

Actually this is a little bit cleaner version than the one tested -- I
divided classes into separate files, changed to CamelCase etc. I hope I
did not change any of the semantics.