changing formatting for output, adding test to cover functionality