refactoring and print tests