Rewrote library for latest rust version.  Work in progress!