Changed format a little bit; subroutines return strings, no, instead of printing directly to output