full implementation

Full implementation of the library, taken from the source code material
of our paper.