clean up and fix of library