Rewrite

Rewrote my version 1.0 of the library based on that of
http://github.com/riccamastellone/