Added some plotting / averaging code JCY