Rewrite the code using canvas
Merge pull request #1 from tangzh/canvas-enhancement

Rewrite the code using canvas