Refactoring and reduce variable number