More standards compliance - added docstring to every module, encoding, removed redundant test module. Various other code cleanups.