remove error message printing from subroutine