Refactoring for the last rest4 commits