rewrite shape.js