some changes to output formatting, also removed unnecessarily complicated JSON nonsense