Refactor and style