Got the core lib working, next to convert it to a lib and add tests and docs