included the previous summary function, to be edited later