Updated with comments and sample codes