Package refactoring. Minor code refactoring