refactoring: nullptr and formatting