Update the Polymer implementation

Newer version of #878 with feedback addressed.