Refactor library dependent javascript into plain Javascript, using CTM check.