factor methods and add empty test, pep8 fixes