Move private library code into lib