refactoring and verifying tests