refactored the sample codes and split into multi modules.