added code comments and examples