add nosetests, code cleanup, module refactoring, add doctests