working library code