function to read out events