All width/height attributes are determined by the canvas dimensions.
Unused code removed.
Performance improvements.