Refactoring and output message updates

Refactoring and output message updates.