Refactored formatter to listener