Added listening function to listen to messges.