added class hierarchy. fixed some tests. fixed pep8
added class hierarchy. fixed some tests. fixed pep8