diff --git a/LineNodes.py b/LineNodes.py
index 9141c44c4752c73eca72a10de9372e8c6573524d..f697308d154d1325eacb7dc3734dadaf6dba5017 100644
--- a/LineNodes.py
+++ b/LineNodes.py
@@ -332,6 +332,7 @@ class ReturnNode(ASTNode):
         self.children = []
         self.expr = None # could be None
         self.typeName = typeName
+        self.method = None # methodNode that this return belongs to
 
         if len(parseTree.children) == 3:
             self.expr = makeNodeFromExpr(parseTree.children[1], typeName)
@@ -355,10 +356,14 @@ class ReturnNode(ASTNode):
         self.outMaybe = False # out[L] = no
 
     def codeGen(self):
+        if hasattr(self, "code") and self.code != "":
+            return
+
         self.code = ""
         if self.expr:
             self.expr.codeGen()
             self.code += self.expr.code
+        self.code += p("jmp", self.method.label + "_end", None, "Return to the end of this method.")
 
 # forStatement and forStatementNoShortIf
 # Rules:
diff --git a/MemberNodes.py b/MemberNodes.py
index 58cd412256a5542c460f7d07223e4c8ffda03a1d..e7c13c8114c06de25639ac58367da0afcfedf29b 100644
--- a/MemberNodes.py
+++ b/MemberNodes.py
@@ -153,6 +153,7 @@ class MethodNode(ASTNode):
 
 
         for n in returnNodes:
+            n.method = self
             # Checking for functions of type void
             # Only valid if either the function doesn't have a return statement, or the return statement is a semicolon (return;)
             if self.myType and self.myType.name == "void":
@@ -183,6 +184,7 @@ class MethodNode(ASTNode):
         if hasattr(self, "code") and self.code != "":
             return
 
+        self.label = "M_" + self.typeName + "_" + self.name + "_" + self.paramTypes
         self.code = pLabel(self.typeName + "_" + self.name + "_" + self.paramTypes, "method")
 
         if self.body:
@@ -197,6 +199,8 @@ class MethodNode(ASTNode):
             self.body.codeGen()
             bodyCode += self.body.code
 
+            bodyCode += self.label + "_end:            ; end of method for " + self.name + "\n"
+
             # pop off all the local var
             for i in range(len(vars)):
                 bodyCode += p("pop", "edx")