moved output formatting into lex