Break up print subroutine into smaller subroutines