Update polymer and some refactoring