refactor and style changes.