Refactor. Read commit messages for details.