improving output generation, adding average, max and min fixes #23 #18