Added average intensity to HDF5 output (some minor changes from previous updates are also committed)