made the library a bit more generic