Small cleanup and refactor