use functions instead of methods
fixed pep8 and static code checking issues
various fixes for tests
various fixes for tests