Improve performance by caching the library #40

fixes #40