Code re-design.

Signed-off-by: oooxff <oooxff@126.com>