sync code
diff --git a/src/ecp.js b/src/ecp.js
index 97c2918..e6c078e 100644
--- a/src/ecp.js
+++ b/src/ecp.js
@@ -23,13 +23,21 @@
     "use strict";
 
     /* Constructor */
-    var ECP = function() {
-        this.x = new ctx.FP(0);
-        this.y = new ctx.FP(1);
-        if (ECP.CURVETYPE != ECP.EDWARDS) {
-            this.z = new ctx.FP(0);
+    var ECP = function(input) {
+        if (input instanceof ECP) {
+            // copy constructor
+            this.x = new ctx.FP(input.x);
+            this.y = new ctx.FP(input.y);
+            this.z = new ctx.FP(input.z);
         } else {
-            this.z = new ctx.FP(1);
+            // default constructor (point at infinity)
+            this.x = new ctx.FP(0);
+            this.y = new ctx.FP(1);
+            if (ECP.CURVETYPE != ECP.EDWARDS) {
+                this.z = new ctx.FP(0);
+            } else {
+                this.z = new ctx.FP(1);
+            }
         }
     };
 
@@ -1337,8 +1345,7 @@
     return ECP;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        ECP: ECP
-    };
+  module.exports.ECP = ECP;
 }
diff --git a/src/ecp2.js b/src/ecp2.js
index b8ce9af..a813edd 100644
--- a/src/ecp2.js
+++ b/src/ecp2.js
@@ -22,11 +22,19 @@
 var ECP2 = function(ctx) {
     "use strict";
 
-    /* Constructor, set this=O */
-    var ECP2 = function() {
-        this.x = new ctx.FP2(0);
-        this.y = new ctx.FP2(1);
-        this.z = new ctx.FP2(0);
+    /* Constructor */
+    var ECP2 = function(input) {
+        if (input instanceof ECP2) {
+            // copy constructor
+            this.x = new ctx.FP2(input.x);
+            this.y = new ctx.FP2(input.y);
+            this.z = new ctx.FP2(input.z);
+        } else {
+            // default constructor (point at infinity)
+            this.x = new ctx.FP2(0);
+            this.y = new ctx.FP2(1);
+            this.z = new ctx.FP2(0);
+        }
     };
 
     ECP2.prototype = {
@@ -779,8 +787,7 @@
     return ECP2;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        ECP2: ECP2
-    };
+  module.exports.ECP2 = ECP2;
 }
diff --git a/src/ecp4.js b/src/ecp4.js
index 82fbce3..9726b89 100644
--- a/src/ecp4.js
+++ b/src/ecp4.js
@@ -22,11 +22,19 @@
 var ECP4 = function(ctx) {
     "use strict";
 
-    /* Constructor, set this=O */
-    var ECP4 = function() {
-        this.x = new ctx.FP4(0);
-        this.y = new ctx.FP4(1);
-        this.z = new ctx.FP4(0);
+    /* Constructor */
+    var ECP4 = function(input) {
+        if (input instanceof ECP4) {
+            // copy constructor
+            this.x = new ctx.FP4(input.x);
+            this.y = new ctx.FP4(input.y);
+            this.z = new ctx.FP4(input.z);
+        } else {
+            // default constructor (point at infinity)
+            this.x = new ctx.FP4(0);
+            this.y = new ctx.FP4(1);
+            this.z = new ctx.FP4(0);
+        }
     };
 
     ECP4.prototype = {
@@ -838,8 +846,7 @@
     return ECP4;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        ECP4: ECP4
-    };
+  module.exports.ECP4 = ECP4;
 }
diff --git a/src/ecp8.js b/src/ecp8.js
index 593f739..644f27f 100644
--- a/src/ecp8.js
+++ b/src/ecp8.js
@@ -22,11 +22,19 @@
 var ECP8 = function(ctx) {
     "use strict";
 
-    /* Constructor, set this=O */
-    var ECP8 = function() {
-        this.x = new ctx.FP8(0);
-        this.y = new ctx.FP8(1);
-        this.z = new ctx.FP8(0);
+    /* Constructor */
+    var ECP8 = function(input) {
+        if (input instanceof ECP8) {
+            // copy constructor
+            this.x = new ctx.FP8(input.x);
+            this.y = new ctx.FP8(input.y);
+            this.z = new ctx.FP8(input.z);
+        } else {
+            // default constructor (point at infinity)
+            this.x = new ctx.FP8(0);
+            this.y = new ctx.FP8(1);
+            this.z = new ctx.FP8(0);
+        }
     };
 
     ECP8.prototype = {
@@ -1044,8 +1052,7 @@
     return ECP8;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        ECP8: ECP8
-    };
+  module.exports.ECP8 = ECP8;
 }
diff --git a/src/pair.js b/src/pair.js
index 36e60d0..bf009a7 100644
--- a/src/pair.js
+++ b/src/pair.js
@@ -127,7 +127,7 @@
             return r;
         },
 
-/* prepare for multi-pairing */
+		/* prepare for multi-pairing */
 		initmp: function() {
 			var r=[];
 			for (var i=0;i<ctx.ECP.ATE_BITS;i++)
@@ -135,7 +135,7 @@
 			return r;
 		},
 
-/* basic Miller loop */
+		/* basic Miller loop */
 		miller: function(r) {
 			var res=new ctx.FP12(1);
 			for (var i=ctx.ECP.ATE_BITS-1; i>=1; i--)
@@ -151,7 +151,7 @@
 			return res;
 		},
 
-/* Accumulate another set of line functions for n-pairing */
+		/* Accumulate another set of line functions for n-pairing */
 		another: function(r,P1,Q1) {
 
 			var f;
@@ -309,8 +309,7 @@
             return r;
         },
 
-        /* Optimal R-ate double pairing e(P,Q).e(R,S) */
-	
+        /* Optimal R-ate double pairing e(P,Q).e(R,S) */	
         ate2: function(P1, Q1, R1, S1) {
             var fa, fb, f, x, n, n3, K, lv, lv2,
                 Qx, Qy, Sx, Sy, A, B, NP,NR,r, nb, bt,
@@ -444,11 +443,11 @@
             r.frob(f);
             r.frob(f);
             r.mul(lv);
-			if (r.isunity())
-			{
-				r.zero();
-				return r;
-			}
+//			if (r.isunity())
+//			{
+//				r.zero();
+//				return r;
+//			}
             /* Hard part of final exp */
             if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) {
                 lv.copy(r);
@@ -565,9 +564,8 @@
         }
     };
 
-/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
-	PAIR.lbits = function(n3,n)
-	{
+	/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
+	PAIR.lbits = function(n3,n) {
 		n.rcopy(ctx.ROM_CURVE.CURVE_Bnx);
 		if (ctx.ECP.CURVE_PAIRING_TYPE==ctx.ECP.BN)
 		{
@@ -585,7 +583,7 @@
 		n3.pmul(3);
 		n3.norm();
 		return n3.nbits();
-	},
+	};
 
     /* GLV method */
     PAIR.glv = function(e) {
@@ -827,8 +825,7 @@
     return PAIR;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        PAIR: PAIR
-    };
+  module.exports.PAIR = PAIR;
 }
diff --git a/src/pair192.js b/src/pair192.js
index 74e9c72..b01ced3 100644
--- a/src/pair192.js
+++ b/src/pair192.js
@@ -125,7 +125,7 @@
             return r;
         },
 
-/* prepare for multi-pairing */
+		/* prepare for multi-pairing */
 		initmp: function() {
 			var r=[];
 			for (var i=0;i<ctx.ECP.ATE_BITS;i++)
@@ -133,7 +133,7 @@
 			return r;
 		},
 
-/* basic Miller loop */
+		/* basic Miller loop */
 		miller: function(r) {
 			var res=new ctx.FP24(1);
 			for (var i=ctx.ECP.ATE_BITS-1; i>=1; i--)
@@ -149,16 +149,15 @@
 			return res;
 		},
 
-/* Accumulate another set of line functions for n-pairing */
+		/* Accumulate another set of line functions for n-pairing */
 		another: function(r,P1,Q1) {
-
 			var f;
 			var n=new ctx.BIG(0);
 			var n3=new ctx.BIG(0);
 			var lv,lv2;
 			var bt;
 
-// P is needed in affine form for line function, Q for (Qx,Qy) extraction
+			// P is needed in affine form for line function, Q for (Qx,Qy) extraction
 			var P=new ctx.ECP4(); P.copy(P1); P.affine();
 			var Q=new ctx.ECP(); Q.copy(Q1); Q.affine();
 
@@ -335,11 +334,11 @@
             lv.copy(r);
             r.frob(f,4);
             r.mul(lv);
-			if (r.isunity())
-			{
-				r.zero();
-				return r;
-			}
+//			if (r.isunity())
+//			{
+//				r.zero();
+//				return r;
+//			}
             /* Hard part of final exp */
             // Ghamman & Fouotsa Method
             t7=new ctx.FP24(r); t7.usqr();
@@ -415,15 +414,14 @@
         }
     };
 
-/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
-	PAIR192.lbits = function(n3,n)
-	{
+	/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
+	PAIR192.lbits = function(n3,n) {
 		n.rcopy(ctx.ROM_CURVE.CURVE_Bnx);
 		n3.copy(n);
 		n3.pmul(3);
 		n3.norm();
 		return n3.nbits();
-	},
+	};
 
     /* GLV method */
     PAIR192.glv = function(e) {
@@ -607,8 +605,7 @@
     return PAIR192;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        PAIR192: PAIR192
-    };
+  module.exports.PAIR192 = PAIR192;
 }
diff --git a/src/pair256.js b/src/pair256.js
index 5dca245..b48126f 100644
--- a/src/pair256.js
+++ b/src/pair256.js
@@ -125,7 +125,7 @@
             return r;
         },
 
-/* prepare for multi-pairing */
+		/* prepare for multi-pairing */
 		initmp: function() {
 			var r=[];
 			for (var i=0;i<ctx.ECP.ATE_BITS;i++)
@@ -133,7 +133,7 @@
 			return r;
 		},
 
-/* basic Miller loop */
+		/* basic Miller loop */
 		miller: function(r) {
 			var res=new ctx.FP48(1);
 			for (var i=ctx.ECP.ATE_BITS-1; i>=1; i--)
@@ -149,16 +149,15 @@
 			return res;
 		},
 
-/* Accumulate another set of line functions for n-pairing */
+		/* Accumulate another set of line functions for n-pairing */
 		another: function(r,P1,Q1) {
-
 			var f;
 			var n=new ctx.BIG(0);
 			var n3=new ctx.BIG(0);
 			var lv,lv2;
 			var bt;
 
-// P is needed in affine form for line function, Q for (Qx,Qy) extraction
+			// P is needed in affine form for line function, Q for (Qx,Qy) extraction
 			var P=new ctx.ECP8(); P.copy(P1); P.affine();
 			var Q=new ctx.ECP(); Q.copy(Q1); Q.affine();
 
@@ -335,11 +334,11 @@
             lv.copy(r);
             r.frob(f,8);
             r.mul(lv);
-			if (r.isunity())
-			{
-				r.zero();
-				return r;
-			}
+//			if (r.isunity())
+//			{
+//				r.zero();
+//				return r;
+//			}
             /* Hard part of final exp */
             // Ghamman & Fouotsa Method
             t7=new ctx.FP48(r); t7.usqr();
@@ -486,15 +485,14 @@
         }
     };
 
-/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
-	PAIR256.lbits = function(n3,n)
-	{
+	/* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
+	PAIR256.lbits = function(n3,n) {
 		n.rcopy(ctx.ROM_CURVE.CURVE_Bnx);
 		n3.copy(n);
 		n3.pmul(3);
 		n3.norm();
 		return n3.nbits();
-	},
+	};
 
     /* GLV method */
     PAIR256.glv = function(e) {
@@ -684,8 +682,7 @@
     return PAIR256;
 };
 
+// CommonJS module exports
 if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
-    module.exports = {
-        PAIR256: PAIR256
-    };
+  module.exports.PAIR256 = PAIR256;
 }