Code refactoring to makes codes shorter