Refactor and formatting.