merged the code from liaochao and removed redundant template design.