improvement code

add subroutine