implementing listening mechanism