Implementation of the lib and a few tests