refactors tests, abstracts out methods