use if instead of unless
remove unnecessary subroutine call