program now listens for messages and keeps track of them