reorganize some sample codes