adding examples of listening interface and minor code cleanup