diff --git a/add_mesh_gears.py b/add_mesh_gears.py
index 75ba8647ef4c4342c7bd44ea68a117b39333cbb1..221b7fb4ca3aecb1608e35b18afc74e7fb739502 100644
--- a/add_mesh_gears.py
+++ b/add_mesh_gears.py
@@ -67,6 +67,18 @@ import mathutils
 from math import *
 from bpy.props import *
 
+# calculates the matrix for the new object
+# depending on user pref
+def align_matrix(context):
+    loc = mathutils.TranslationMatrix(context.scene.cursor_location)
+    obj_align = context.user_preferences.edit.object_align
+    if (context.space_data.type == 'VIEW_3D'
+        and obj_align == 'VIEW'):
+        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+    else:
+        rot = mathutils.Matrix()
+    newMatrix = loc * rot
+    return newMatrix
 
 # Stores the values of a list of properties and the
 # operator id in a property group ('recall_op') inside the object.
@@ -752,7 +764,7 @@ class AddGear(bpy.types.Operator):
         min=0.0,
         max=100.0,
         default=0.0)
-    newMatrix = 'fromInvoke'
+    newMatrix = mathutils.Matrix()
 
     def draw(self, context):
         props = self.properties
@@ -818,14 +830,7 @@ class AddGear(bpy.types.Operator):
         return {'FINISHED'}
 
     def invoke(self, context, event):
-        loc = mathutils.TranslationMatrix(context.scene.cursor_location)
-        obj_align = context.user_preferences.edit.object_align
-        if (context.space_data.type == 'VIEW_3D'
-            and obj_align == 'VIEW'):
-            rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
-        else:
-            rot = mathutils.RotationMatrix()
-        self.newMatrix = loc * rot
+        self.newMatrix = align_matrix(context)
         self.execute(context)
         return {'FINISHED'}
 
@@ -885,7 +890,7 @@ class AddWormGear(bpy.types.Operator):
         min=0.0,
         max=100.0,
         default=0.0)
-    newMatrix = 'fromInvoke'
+    newMatrix = mathutils.Matrix()
 
     def draw(self, context):
         props = self.properties
@@ -947,14 +952,7 @@ class AddWormGear(bpy.types.Operator):
         return {'FINISHED'}
 
     def invoke(self, context, event):
-        loc = mathutils.TranslationMatrix(context.scene.cursor_location)
-        obj_align = context.user_preferences.edit.object_align
-        if (context.space_data.type == 'VIEW_3D'
-            and obj_align == 'VIEW'):
-            rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
-        else:
-            rot = mathutils.RotationMatrix()
-        self.newMatrix = loc * rot
+        self.newMatrix = align_matrix(context)
         self.execute(context)
         return {'FINISHED'}
 
diff --git a/add_mesh_pipe_joint.py b/add_mesh_pipe_joint.py
index beea04cd19e32e34762084bcef3e4b502e0927e9..803d79e52380711f7324b4edf30beb5693bc920d 100644
--- a/add_mesh_pipe_joint.py
+++ b/add_mesh_pipe_joint.py
@@ -145,25 +145,26 @@ def store_recall_properties(ob, op, op_args):
 
 # Apply view rotation to objects if "Align To" for
 # new objects was set to "VIEW" in the User Preference.
-def apply_object_align(context, ob):
-    obj_align = bpy.context.user_preferences.edit.object_align
-
+# Is now handled in the invoke functions
+# calculates the matrix for the new object
+# depending on user pref
+def align_matrix(context):
+    loc = mathutils.TranslationMatrix(context.scene.cursor_location)
+    obj_align = context.user_preferences.edit.object_align
     if (context.space_data.type == 'VIEW_3D'
         and obj_align == 'VIEW'):
-            view3d = context.space_data
-            region = view3d.region_3d
-            viewMatrix = region.view_matrix
-            rot = viewMatrix.rotation_part()
-            ob.rotation_euler = rot.invert().to_euler()
-
-
+        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+    else:
+        rot = mathutils.Matrix()
+    newMatrix = loc * rot
+    return newMatrix
 # Create a new mesh (object) from verts/edges/faces.
 # verts/edges/faces ... List of vertices/edges/faces for the
 #                       new mesh (as used in from_pydata).
 # name ... Name of the new mesh (& object).
 # edit ... Replace existing mesh data.
 # Note: Using "edit" will destroy/delete existing mesh data.
-def create_mesh_object(context, verts, edges, faces, name, edit):
+def create_mesh_object(context, verts, edges, faces, name, edit, newMatrix):
     scene = context.scene
     obj_act = scene.objects.active
 
@@ -216,9 +217,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit):
         ob_new.selected = True
 
         # Place the object at the 3D cursor location.
-        ob_new.location = scene.cursor_location
-
-        apply_object_align(context, ob_new)
+        ob_new.matrix = newMatrix
 
     if obj_act and obj_act.mode == 'EDIT':
         if not edit:
@@ -359,6 +358,7 @@ class AddElbowJoint(bpy.types.Operator):
         min=0.01,
         max=100.0,
         unit="LENGTH")
+    newMatrix = mathutils.Matrix()
 
     def execute(self, context):
         edit = self.properties.edit
@@ -419,7 +419,7 @@ class AddElbowJoint(bpy.types.Operator):
         faces.extend(createFaces(loop2, loop3, closed=True))
 
         obj = create_mesh_object(context, verts, [], faces,
-            "Elbow Joint", edit)
+            "Elbow Joint", edit, self.newMatrix)
 
         # Store 'recall' properties in the object.
         recall_args_list = {
@@ -433,6 +433,10 @@ class AddElbowJoint(bpy.types.Operator):
 
         return {'FINISHED'}
 
+    def invoke(self, context, event):
+        self.newMatrix = align_matrix(context)
+        self.execute(context)
+        return {'FINISHED'}
 
 class AddTeeJoint(bpy.types.Operator):
     # Create the vertices and polygons for a simple tee (T) joint.
@@ -488,6 +492,7 @@ class AddTeeJoint(bpy.types.Operator):
         min=0.01,
         max=100.0,
         unit="LENGTH")
+    newMatrix = mathutils.Matrix()
 
     def execute(self, context):
         edit = self.properties.edit
@@ -615,7 +620,7 @@ class AddTeeJoint(bpy.types.Operator):
         faces.extend(createFaces(loopJoint2, loopArm, closed=True))
         faces.extend(createFaces(loopJoint3, loopMainEnd, closed=True))
 
-        obj = create_mesh_object(context, verts, [], faces, "Tee Joint", edit)
+        obj = create_mesh_object(context, verts, [], faces, "Tee Joint", edit, self.newMatrix)
 
         # Store 'recall' properties in the object.
         recall_args_list = {
@@ -630,6 +635,10 @@ class AddTeeJoint(bpy.types.Operator):
 
         return {'FINISHED'}
 
+    def invoke(self, context, event):
+        self.newMatrix = align_matrix(context)
+        self.execute(context)
+        return {'FINISHED'}
 
 class AddWyeJoint(bpy.types.Operator):
     '''Add a Wye-Joint mesh'''
@@ -689,6 +698,7 @@ class AddWyeJoint(bpy.types.Operator):
         min=0.01,
         max=100.0,
         unit="LENGTH")
+    newMatrix = mathutils.Matrix()
 
     def execute(self, context):
         edit = self.properties.edit
@@ -827,7 +837,7 @@ class AddWyeJoint(bpy.types.Operator):
         faces.extend(createFaces(loopJoint2, loopArm1, closed=True))
         faces.extend(createFaces(loopJoint3, loopArm2, closed=True))
 
-        obj = create_mesh_object(context, verts, [], faces, "Wye Joint", edit)
+        obj = create_mesh_object(context, verts, [], faces, "Wye Joint", edit, self.newMatrix)
 
         # Store 'recall' properties in the object.
         recall_args_list = {
@@ -843,6 +853,10 @@ class AddWyeJoint(bpy.types.Operator):
 
         return {'FINISHED'}
 
+    def invoke(self, context, event):
+        self.newMatrix = align_matrix(context)
+        self.execute(context)
+        return {'FINISHED'}
 
 class AddCrossJoint(bpy.types.Operator):
     '''Add a Cross-Joint mesh'''
@@ -913,6 +927,7 @@ class AddCrossJoint(bpy.types.Operator):
         min=0.01,
         max=100.0,
         unit="LENGTH")
+    newMatrix = mathutils.Matrix()
 
     def execute(self, context):
         edit = self.properties.edit
@@ -1102,7 +1117,7 @@ class AddCrossJoint(bpy.types.Operator):
         faces.extend(createFaces(loopJoint4, loopArm3, closed=True))
 
         obj = create_mesh_object(context, verts, [], faces,
-            "Cross Joint", edit)
+            "Cross Joint", edit, self.newMatrix)
 
         # Store 'recall' properties in the object.
         recall_args_list = {
@@ -1120,6 +1135,10 @@ class AddCrossJoint(bpy.types.Operator):
 
         return {'FINISHED'}
 
+    def invoke(self, context, event):
+        self.newMatrix = align_matrix(context)
+        self.execute(context)
+        return {'FINISHED'}
 
 class AddNJoint(bpy.types.Operator):
     '''Add a N-Joint mesh'''
@@ -1156,6 +1175,7 @@ class AddNJoint(bpy.types.Operator):
         min=0.01,
         max=100.0,
         unit="LENGTH")
+    newMatrix = mathutils.Matrix()
 
     def execute(self, context):
         edit = self.properties.edit
@@ -1280,7 +1300,7 @@ class AddNJoint(bpy.types.Operator):
                 createFaces(loopsJoints[loopIdx],
                 loopsEndCircles[loopIdx], closed=True))
 
-        obj = create_mesh_object(context, verts, [], faces, "N Joint", edit)
+        obj = create_mesh_object(context, verts, [], faces, "N Joint", edit, self.newMatrix)
 
         # Store 'recall' properties in the object.
         recall_args_list = {
@@ -1293,6 +1313,10 @@ class AddNJoint(bpy.types.Operator):
 
         return {'FINISHED'}
 
+    def invoke(self, context, event):
+        self.newMatrix = align_matrix(context)
+        self.execute(context)
+        return {'FINISHED'}
 
 class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
     # Define the "Pipe Joints" menu