change the structure of the code, make it more like a lib