Refactoring the remaining code.