Move implementation into ./lib