refactoring code with static