Refactor and reindent