added comments and enhanced example