final refactoring for 1.3