Fixed a couple of bugs and made some optimizations

-fixed a couple of bugs that prevented me from using the wrapper initially
-made some optimizations to get rid of a visible jitter