Started to transform the code into a lib