Updates, bug fixes

Added some minimal documentation too.