Refactoring to 3.1 version