refactored output pattern

Refactored