Make repeated codes in functions

 -