Rearranged some stuff to prepare for the ManagedPtr, and began addind ManagedPtr including tests. Part of #60