change number of variable and refactoring the method