Refactor status output code.