Make reusable code to the repeated code