code refactoring v2.1