tests + refactoring
minimal output example