big clean up after pull request accept.  major issue was unconventional
use of Either -- convention is that the "right" answer is Right, and the
error is Left.  this has been repaired to adhere to common convention.
also, performed some aesthetic cleanup and squashed compiler warnings.