added comments including some test code