changed messages to be pushed into array, instead of updating entire array each time