diff --git a/_ucoinpy_test/documents/test_certification.py b/_ucoinpy_test/documents/test_certification.py
index 62499b9733f648046eab6be2e069354f4bd59c3d..28cae8d90c17cfbb005e969bcc6212785f3e43ab 100644
--- a/_ucoinpy_test/documents/test_certification.py
+++ b/_ucoinpy_test/documents/test_certification.py
@@ -10,11 +10,12 @@ from mock import Mock
 
 inline_selfcert = ""
 
+
 class Test_SelfCertification:
     '''
     classdocs
     '''
 
     def test_certification(self):
+        version = 1
         selfcert = SelfCertification.from_inline(version, inline_selfcert)
-        
diff --git a/_ucoinpy_test/documents/test_membership.py b/_ucoinpy_test/documents/test_membership.py
index b9b6c022d442cc9256b5524eaba87393ffcc626d..b9bb639cd8b080075d76738c5bbfb3c9f12972b0 100644
--- a/_ucoinpy_test/documents/test_membership.py
+++ b/_ucoinpy_test/documents/test_membership.py
@@ -4,13 +4,13 @@ Created on 12 déc. 2014
 @author: inso
 '''
 import pytest
-from ucoinpy.documents.transaction import Transaction
+from ucoinpy.documents.membership import Membership
 from mock import Mock
 
 inline_membership = ""
 
+
 class Test_Membership:
     def test_frominline(self):
         membership = Membership.from_inline(inline_membership)
 
-        
\ No newline at end of file
diff --git a/_ucoinpy_test/documents/test_transaction.py b/_ucoinpy_test/documents/test_transaction.py
index 1b6b8951f4855621fe087cf9360aa2e9e98a5db3..97a66823542b8ed64c416f3a7cf2e883d45ea3e7 100644
--- a/_ucoinpy_test/documents/test_transaction.py
+++ b/_ucoinpy_test/documents/test_transaction.py
@@ -25,24 +25,24 @@ class Test_Transaction:
         assert tx.issuers.len == 1
         assert tx.inputs.len == 1
         assert tx.outputs.len == 3
-        
+
         assert tx.inputs[0].index == 0
         assert tx.inputs[0].source == 'T'
         assert tx.inputs[0].number == 65
         assert tx.inputs[0].pubkey == "D717FEC1993554F8EAE4CEA88DE5FBB6887CFAE8"
         assert tx.inputs[0].amount == 4
-        
+
         assert tx.inputs[1].index == 0
         assert tx.inputs[1].source == 'T'
         assert tx.inputs[1].number == 77
         assert tx.inputs[1].pubkey == "F80993776FB55154A60B3E58910C942A347964AD"
         assert tx.inputs[1].amount == 15
-        
+
         assert tx.inputs[2].index == 0
         assert tx.inputs[2].source == 'D'
         assert tx.inputs[2].number == 88
         assert tx.inputs[2].pubkey == "F4A47E39BC2A20EE69DCD5CAB0A9EB3C92FD8F7B"
         assert tx.inputs[2].amount == 11
-        
+
         assert tx.outputs[0].pubkey == "BYfWYFrsyjpvpFysgu19rGK3VHBkz4MqmQbNyEuVU64g"
         assert tx.outputs[1].amount == 30
diff --git a/ucoinpy/documents/peer.py b/ucoinpy/documents/peer.py
index 30cafe5121960df0b406098c47600adc51ce5c15..6d4c50ca2ede69909d6d7f18bc4e3640a08e7e72 100644
--- a/ucoinpy/documents/peer.py
+++ b/ucoinpy/documents/peer.py
@@ -24,9 +24,8 @@ class Peer(Document):
     [...]
     """
 
-    def __init__(self, version, pubkey, blockid, endpoints, signature):
+    def __init__(self, version, currency, pubkey, blockid, endpoints, signature):
         super(version, currency, [signature])
-        self.currency = currency
         self.pubkey = pubkey
         self.blockid = blockid
         self.endpoints = endpoints
@@ -48,7 +47,7 @@ Endpoints:
 
         for endpoint in self.endpoints:
             doc += "{0}\n".format(endpoint.inline())
-         
+
         doc += "{0}\n".format(self.signatures[0])
         return doc
 
diff --git a/ucoinpy/documents/transaction.py b/ucoinpy/documents/transaction.py
index 38190895394e56949a95c42596eb7c2355a4fe11..d73d4e60b52b52279b232eb7f3c17f3bb9d5747a 100644
--- a/ucoinpy/documents/transaction.py
+++ b/ucoinpy/documents/transaction.py
@@ -5,12 +5,12 @@ Created on 2 déc. 2014
 '''
 
 from . import Document
-from .. import PROTOCOL_VERSION
+import re
 
 
 class Transaction(Document):
     '''
-Document format : 
+Document format :
 Version: VERSION
 Type: Transaction
 Currency: CURRENCY_NAME
@@ -27,7 +27,7 @@ Comment: COMMENT
 ...
 
 
-Compact format : 
+Compact format :
 TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_OUTPUTS:HAS_COMMENT
 PUBLIC_KEY:INDEX
 ...
@@ -47,7 +47,8 @@ SIGNATURE
     re_outputs = re.compile("Outputs:\n")
     re_pubkey = re.compile("([1-9A-Za-z][^OIl]{43,45})\n")
 
-    def __init__(self, version, currency, issuers, inputs, outputs, signatures):
+    def __init__(self, version, currency, issuers, inputs, outputs,
+                 comment, signatures):
         '''
         Constructor
         '''
@@ -59,57 +60,58 @@ SIGNATURE
 
     @classmethod
     def from_compact(cls, currency, number, compact):
-        lines = raw.splitlines(True)
+        lines = compact.splitlines(True)
         n = 0
-        
-        header_data = re_header.match(lines[n])
+
+        header_data = Transaction.re_header.match(lines[n])
         version = header_data.group(2)
         issuers_num = int(header_data.group(3))
         inputs_num = int(header_data.group(3))
         outputs_num = int(header_data.group(3))
         n = n + 1
-        
+
         issuers = []
         inputs = []
         outputs = []
         signatures = []
-        
+
         for i in range(0, issuers_num):
-            issuer = re_pubkey.match(lines[n]).group(1)
+            issuer = Transaction.re_pubkey.match(lines[n]).group(1)
             issuers.append(issuer)
             n = n + 1
-        
+
         for i in range(0, inputs_num):
             input = InputSource.from_compact(lines[n])
             inputs.append(issuer)
             n = n + 1
-            
+
         for i in range(0, outputs_num):
             output = OutputSource.from_inline(lines[n])
             outputs.append(output)
             n = n + 1
-            
+
         return cls(version, currency, issuers, inputs, outputs, signatures)
 
 
     @classmethod
     def from_raw(cls, raw):
+        lines = raw.splitlines(True)
         n = 0
-        
+
         version = Transaction.re_version.match(lines[n]).group(1)
         n = n + 1
-        
-        type = Transaction.re_type.match(lines[n]).group(1)
+
+        Transaction.re_type.match(lines[n]).group(1)
         n = n + 1
-        
+
         currency = Transaction.re_currency.match(lines[n]).group(1)
         n = n + 1
-        
+
         issuers = []
         inputs = []
         outputs = []
         signatures = []
-        
+
         if Transaction.re_issuers.match(lines[n]):
             lines = lines + 1
             while Transaction.re_inputs.match(lines[n]) is None:
@@ -120,8 +122,8 @@ SIGNATURE
         if Transaction.re_inputs.match(lines[n]):
             lines = lines + 1
             while Transaction.re_outputs.match(lines[n]) is None:
-                input = InputSource.from_compact(number, lines[n])
-                inputs.append(input)
+                input_source = InputSource.from_inline(lines[n])
+                inputs.append(input_source)
                 lines = lines + 1
 
         if Transaction.re_outputs.match(lines[n]) is not None:
@@ -129,14 +131,13 @@ SIGNATURE
                 output = OutputSource.from_inline(lines[n])
                 outputs.append(output)
                 lines = lines + 1
-        
-        
+
         if Transaction.re_sign.match(lines[n]) is not None:
             while n < lines.len:
-                sign = re_sign.match(lines[n]).group(1)
+                sign = Transaction.re_sign.match(lines[n]).group(1)
                 signatures.append(sign)
                 lines = lines + 1
-            
+
         return cls(version, currency, issuers, inputs, outputs, signatures)
 
     def raw(self):
@@ -165,7 +166,7 @@ COMMENT:
 
         for signature in self.signatures:
             doc += "{0}\n".format(signature)
-        
+
         return doc
 
     def compact(self):
@@ -199,28 +200,32 @@ COMMENT
 
         return doc
 
+
 class SimpleTransaction(Transaction):
     '''
 As transaction class, but for only one issuer.
 ...
     '''
-    def __init__(self, version, currency, issuer, single_input, outputs, comment, signature):
+    def __init__(self, version, currency, issuer,
+                 single_input, outputs, comment, signature):
         '''
         Constructor
         '''
-        super(version, currency, [issuer], [single_input], outputs, comment, [signature])
+        super(version, currency, [issuer], [single_input],
+              outputs, comment, [signature])
 
 
 class InputSource():
     '''
     A Transaction INPUT
-    
-    Compact : 
+
+    Compact :
     INDEX:SOURCE:FINGERPRINT:AMOUNT
     '''
-    re_inline = re.compile("([0-9]+):(D|T):([0-9]+):([0-9a-fA-F]{5,40}):([0-9]+)")
+    re_inline = re.compile("([0-9]+):(D|T):([0-9]+):\
+    ([0-9a-fA-F]{5,40}):([0-9]+)")
     re_compact = re.compile("([0-9]+):(D|T):([0-9a-fA-F]{5,40}):([0-9]+)")
-    
+
     def __init__(self, index, source, number, txhash, amount):
         self.index = index
         self.source = source
@@ -230,24 +235,23 @@ class InputSource():
 
     @classmethod
     def from_inline(cls, inline):
-        data = re_inline.match(inline)
+        data = InputSource.re_inline.match(inline)
         index = data.group(1)
         source = data.group(2)
         number = data.group(3)
         txhash = data.group(4)
-        amount = data;group(5)
+        amount = data.group(5)
         return cls(data, index, source, number, txhash, amount)
-     
-     @classmethod
-     def from_compact(cls, number, compact):
-        data = re_compact.match(inline)
+
+    @classmethod
+    def from_compact(cls, number, compact):
+        data = InputSource.re_compact.match(compact)
         index = data.group(1)
         source = data.group(2)
         txhash = data.group(3)
-        amount = data;group(4)
+        amount = data.group(4)
         return cls(data, index, source, number, txhash, amount)
-     
-        
+
     def inline(self):
         return "{0}:{1}:{2}:{3}:{4}".format(self.index,
                                             self.source,
@@ -267,13 +271,14 @@ class OutputSource():
     A Transaction OUTPUT
     '''
     re_inline = "([1-9A-Za-z][^OIl]{43,45}):([0-9]+)"
+
     def __init__(self, pubkey, amount):
         self.pubkey = pubkey
         self.amount = amount
-    
-    @lassmethod
+
+    @classmethod
     def from_inline(cls, inline):
-        data = re_inline.match(inline)
+        data = OutputSource.re_inline.match(inline)
         pubkey = data.group(1)
         amount = data.group(2)
         return cls(pubkey, amount)