bug cleanup
structure the library correctly
fixes to example