Initial refactoring of tests

Issue #7