Optimized the library a bit by calling primitives directly instead of wrappers.