handle various output scenarios