diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index 84abd9c79457d3bcabbec97e3db4349a03badfb9..0670018dd8997d18b3d4a397c886d19099b81e37 100644
--- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -9,6 +9,7 @@
 
 #define ENABLE_ASSERTS
 #define TARGET_PTX 32
+#define GLOBAL_ADDRSPACE 1
 
 #define DEBUG_TYPE "DFG2LLVM_NVPTX"
 #include "llvm/IR/DataLayout.h"
@@ -70,7 +71,7 @@ namespace {
     ValueMap<Function*, Function*> FMap; 
 
     //Functions
-    void addReturnValueArgs(Function* F);
+    void transformFunctionToVoid(Function* F);
 
     void codeGen(DFInternalNode* N);
     void codeGen(DFLeafNode* N);
@@ -112,13 +113,12 @@ namespace {
     if (N == KernelLaunchNode) {
       DEBUG(errs() << "Found kernel launch node. Generating host code.\n");
       //TODO
-      DEBUG(errs() << "Changing pointer address spaces to addrspace 1.\n");
-      //TODO
+
+      // Now the remaining nodes to be visited should be ignored
+      KernelLaunchNode = NULL;
     } else {
       DEBUG(errs() << "Found intermediate node. Generating device code.\n");
       //TODO
-      DEBUG(errs() << "Changing leaf node function to device function.\n");
-      //TODO
     }
 
   }
@@ -169,7 +169,7 @@ namespace {
       FMap[F] = F_nvptx;
     }
 
-    addReturnValueArgs(F_nvptx);
+    transformFunctionToVoid(F_nvptx);
 
     // Go through all the instructions
     for (inst_iterator i = inst_begin(F_nvptx), e = inst_end(F_nvptx); i != e; ++i) {
@@ -417,11 +417,11 @@ namespace {
     return true;
   }
 
-  void CodeGenTraversal::addReturnValueArgs(Function* F) {
+  void CodeGenTraversal::transformFunctionToVoid(Function* F) {
 
     // FIXME: Maybe do that using the Node?
     StructType* FRetTy = cast<StructType>(F->getReturnType());
-    assert(FRetTy && "Return Type is NULL, it should be a struct");
+    assert(FRetTy && "Return Type must always be a struct");
 
     // Keeps return statements, because we will need to replace them
     std::vector<ReturnInst *> RItoRemove;
@@ -445,31 +445,27 @@ namespace {
       return;
     }
 
-    // The struct has return values that need to be converted to parameters
+    // The struct has return values, thus needs to be converted to parameter
 
     int initialNumParams = F->arg_size();
 
-    // Create the extra parameters with appropriate pointer types
-    for (unsigned i=0; i < FRetTy->getNumElements(); i++) {
-      Type* FieldType = FRetTy->getElementType(i);
-      Type* ArgType = FieldType->getPointerTo(); //TODO: AddressSpace
-      new Argument(ArgType, "ret_arg_" + convertInt(i), F);
-    }
-    DEBUG(errs() << "\tCreated parameters\n");
+    Type* ArgType = FRetTy->getPointerTo(GLOBAL_ADDRSPACE);
+    new Argument(ArgType, "ret_struct_ptr", F);
+    DEBUG(errs() << "\tCreated parameter\n");
 
-    // Create the argument type list with added argument types
+    // Create the argument type list with the added argument's type
     std::vector<Type*> ArgTypes;
     for(Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
         ai != ae; ++ai) {
       ArgTypes.push_back(ai->getType());
     }
 
-    // Find where the new parameters start in the header
+    // Find where the new parameter is in the header
     Function::arg_iterator ai, ae;
     int check = 0;
     for (ai = F->arg_begin(), ae = F->arg_end();
          ai != ae; ++ai) {
-      if (ai->getName().startswith("ret_arg_")) break;
+      if (ai->getName().equals("ret_struct_ptr")) break;
       check++;
     }
 
@@ -486,15 +482,7 @@ namespace {
      // StructType* RetType = cast<StructType>(RetVal->getType());
      // assert(RetType && "Return type is not a struct");
 
-      Function::arg_iterator ret_ai = ai;
-      for (unsigned i=0; i < FRetTy->getNumElements(); i++, ++ret_ai) {
-        std::vector<unsigned> IndexList;
-        IndexList.push_back(i);
-        ExtractValueInst* EI = ExtractValueInst::Create(RetVal, IndexList, Twine(""), RI);
-       // StoreInst* SI = new StoreInst(EI, &(*ret_ai), RI);
-        new StoreInst(EI, &(*ret_ai), RI);
-      }
-
+      new StoreInst(RetVal, &(*ai), RI);
       ReturnInst::Create((F->getContext()), 0, RI);
       RI->eraseFromParent();