 
         binary_to_string: (bin) =>
             # We print the size of the binary, not the size of the base 64 string
-            size = bin.data.length*3/4
             blocks_of_76 = Math.floor(bin.data.length/78) # 78 to count \r\n
             leftover = bin.data.length-blocks_of_76*78
 
             base64_digits = 76*blocks_of_76+leftover
 
             blocks_of_4 = Math.floor(base64_digits/4)
-            leftover2 = base64_digits-Math.floor(base64_digits/4)
-
-            if bin.data.slice(-2) is '=='
+
+            end = bin.data.slice(-2)
+            if end is '=='
                 number_of_equals = 2
-            else if bin.data.slice(-1) is '='
+            else if end.slice(-1) is '='
                 number_of_equals = 1
             else
                 number_of_equals = 0

            if size is 0
                return "<binary, #{sizeStr}>"
            else
                str = atob bin.data.replace(/[ \r\n]+$/, "")
                snippet = ''
                for char, i  in str
                    next = str.charCodeAt(i).toString(16)


            if size >= 1073741824
                sizeStr = (size/1073741824).toFixed(1)+'GB'
            else if size >= 1048576
                sizeStr = (size/1048576).toFixed(1)+'MB'
            else if size >= 1024
                sizeStr = (size/1024).toFixed(1)+'KB'
            else if size is 1
                sizeStr = size+' byte'
            else
                sizeStr = size+' bytes'


