diff --git a/dream/simulation/Assembly.py b/dream/simulation/Assembly.py
index 5f14250cc190cbcdc35e414121c6a0ecbe41c590..089d872614c93dbd3249094d15aecd1890062051 100644
--- a/dream/simulation/Assembly.py
+++ b/dream/simulation/Assembly.py
@@ -42,7 +42,7 @@ class Assembly(CoreObject):
         self.type="Assembly"   #String that shows the type of object
         self.distType=distribution          #the distribution that the procTime follows  
         self.rng=RandomNumberGenerator(self, self.distType)
-        self.rng.avg=mean
+        self.rng.mean=mean
         self.rng.stdev=stdev
         self.rng.min=min
         self.rng.max=max                    
diff --git a/dream/simulation/BatchDecomposition.py b/dream/simulation/BatchDecomposition.py
index 117602bc02696ec50985a3763bc05d86890451bb..2b748068a4f7b983d6b41e4dd13cfa4bc2d59756 100644
--- a/dream/simulation/BatchDecomposition.py
+++ b/dream/simulation/BatchDecomposition.py
@@ -56,7 +56,7 @@ class BatchDecomposition(CoreObject):
         self.operator=operator         
         # Sets the attributes of the processing (and failure) time(s)
         self.rng=RandomNumberGenerator(self, self.distType)
-        self.rng.avg=mean
+        self.rng.mean=mean
         self.rng.stdev=stdev
         self.rng.min=min
         self.rng.max=max
diff --git a/dream/simulation/BatchReassembly.py b/dream/simulation/BatchReassembly.py
index 48d86afb5c85f3d34036016a496a380fd6af2fae..1dfd85011d2a174c1212cc7bb6af5dfa2041d750 100644
--- a/dream/simulation/BatchReassembly.py
+++ b/dream/simulation/BatchReassembly.py
@@ -60,7 +60,7 @@ class BatchReassembly(CoreObject):
         self.operator=operator         
         # Sets the attributes of the processing (and failure) time(s)
         self.rng=RandomNumberGenerator(self, self.distType)
-        self.rng.avg=mean
+        self.rng.mean=mean
         self.rng.stdev=stdev
         self.rng.min=min
         self.rng.max=max
diff --git a/dream/simulation/BatchScrapMachine.py b/dream/simulation/BatchScrapMachine.py
index e403c6daf0419dcab4513fe2cb8f8674062dc287..1e8a7b9b374e66a50b2d014d6d4771bc0907ed63 100644
--- a/dream/simulation/BatchScrapMachine.py
+++ b/dream/simulation/BatchScrapMachine.py
@@ -39,15 +39,18 @@ class BatchScrapMachine(Machine):
     #initialize the id, the capacity of the resource and the distribution       
     # have to find which distribution returns random integers - Discrete distribution 
     def __init__(self, id, name, capacity=1, \
+                 processingTime=None,
                  distribution='Fixed', mean=1, stdev=0, min=0, max=10,\
                  failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None',\
                  scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10,
                  **kw):
+        if not processingTime:
+          print "TODO"
         # initialize using the default method of the object 
         Machine.__init__(self,id=id,name=name,\
                                     capacity=capacity,\
-                                    distribution=distribution,\
-                                    mean=mean,stdev=stdev,min=min,max=max,\
+                                    processingTime=dict(distributionType=distribution,
+                                                        mean=mean,stdev=stdev,min=min,max=max,),
                                     failureDistribution=failureDistribution,MTTF=MTTF,MTTR=MTTR,\
                                     availability=availability,
                                     repairman=repairman, **kw)
@@ -55,7 +58,7 @@ class BatchScrapMachine(Machine):
         self.scrapDistType=scrapDistribution    #the distribution that the failure follows   
         # Sets the attributes of the scrap quantity distribution
         self.scrapRng=RandomNumberGenerator(self, self.scrapDistType)
-        self.scrapRng.avg=scrMean
+        self.scrapRng.mean=scrMean
         self.scrapRng.stdev=scrStdev
         self.scrapRng.min=scrMin
         self.scrapRng.max=scrMax
diff --git a/dream/simulation/Dismantle.py b/dream/simulation/Dismantle.py
index 9660f889a7500ccf69acbd7ee61f4f2aafcedf99..c38f4d0ed417ca67540fdc677b30762cf0233c2b 100644
--- a/dream/simulation/Dismantle.py
+++ b/dream/simulation/Dismantle.py
@@ -47,7 +47,7 @@ class Dismantle(CoreObject):
         self.type="Dismantle"   #String that shows the type of object
         self.distType=distribution          #the distribution that the procTime follows  
         self.rng=RandomNumberGenerator(self, self.distType)
-        self.rng.avg=mean
+        self.rng.mean=mean
         self.rng.stdev=stdev
         self.rng.min=min
         self.rng.max=max                    
diff --git a/dream/simulation/Failure.py b/dream/simulation/Failure.py
index c96221e04f998378a694b6e73fd02eeb8715a7c3..2501b8a6bfb69ad768f47a3c0ae02d78dc7b7002 100644
--- a/dream/simulation/Failure.py
+++ b/dream/simulation/Failure.py
@@ -73,10 +73,10 @@ class Failure(ObjectInterruption):
             #               if the distribution is fixed
             # --------------------------------------------------------------
             self.rngTTF=RandomNumberGenerator(self, self.distType)
-            self.rngTTF.avg=MTTF            
+            self.rngTTF.mean=MTTF
             self.rngTTR=RandomNumberGenerator(self, self.distType)
-            self.rngTTR.avg=MTTR
-    
+            self.rngTTR.mean=MTTR
+
     # =======================================================================
     #    The run method for the failure which has to served by a repairman
     # =======================================================================
diff --git a/dream/simulation/GUI/Default.py b/dream/simulation/GUI/Default.py
index da21c26d25912d1b21dd012569a90246b1bcb61a..3aca0e9e6f7403617669888329e22e42a318a248 100644
--- a/dream/simulation/GUI/Default.py
+++ b/dream/simulation/GUI/Default.py
@@ -7,7 +7,7 @@ schema = {
     "id": "entity",
     "type": "string",
     "_class": "Dream.Property",
-    "_default": "Part"
+    "_default": "Dream.Part"
   },
   "mean": {
     "id": "mean",
diff --git a/dream/simulation/LineGenerationJSON.py b/dream/simulation/LineGenerationJSON.py
index 2b1d4bda5d472b4e11437c5be64c674461683089..d04463fb953f6c624d9f2684b44b636e401d565a 100644
--- a/dream/simulation/LineGenerationJSON.py
+++ b/dream/simulation/LineGenerationJSON.py
@@ -312,9 +312,8 @@ def createObjects():
             for repairman in G.RepairmanList:                   # check which repairman in the G.RepairmanList
                 if(id in repairman.coreObjectIds):              # (if any) is assigned to repair 
                     r=repairman                                 # the machine with ID equal to id
-            M=Machine(id, name, 1, distribution=distributionType,  failureDistribution=failureDistribution,
+            M=Machine(id, name, 1, processingTime,  failureDistribution=failureDistribution,
                                                     MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
-                                                    mean=mean,stdev=stdev,min=min,max=max,
                                                     operatorPool=machineOperatorPoolList, operationType=operationType,
                                                     loadDistribution=loadDistribution, setupDistribution=setupDistribution,
                                                     setupMean=setupMean,setupStdev=setupStdev,setupMin=setupMin,setupMax=setupMax,
diff --git a/dream/simulation/Machine.py b/dream/simulation/Machine.py
index dd2a6e885cadd8a98fa5171c6f368cd1847de6b7..0386423709496ee94e0acfcdb0e47e84122103b8 100644
--- a/dream/simulation/Machine.py
+++ b/dream/simulation/Machine.py
@@ -44,27 +44,30 @@ class Machine(CoreObject):
     # =======================================================================
     # initialise the id the capacity, of the resource and the distribution
     # =======================================================================
-    def __init__(self, id, name, capacity=1, distribution='Fixed', mean=1, stdev=0, min=0, max=10,\
+    def __init__(self, id, name, capacity=1, processingTime=None,
                   failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None',\
                   operatorPool='None',operationType='None',\
                   loadDistribution="No",loadMean=0, loadStdev=0, loadMin=0, loadMax=10,
                   setupDistribution="No",setupMean=0, setupStdev=0, setupMin=0, setupMax=10,
                   isPreemptive=False, resetOnPreemption=False, **kw):
+
         CoreObject.__init__(self, id, name)
         self.type="Machine"                         #String that shows the type of object
+        if not processingTime:
+          processingTime = {'distributionType': 'Fixed',
+                            'mean': 1,
+                            'stdev': 0,
+                            'min': 0,
+                            'max': 10}
+
         #     holds the capacity of the machine 
         self.capacity=capacity
         #     define the distribution types of the processing and failure times respectively
-        self.distType=distribution                  #the distribution that the procTime follows      
         self.failureDistType=failureDistribution    #the distribution that the failure follows   
         #     sets the repairman resource of the Machine
-        self.repairman=repairman         
+        self.repairman=repairman
         #     Sets the attributes of the processing (and failure) time(s)
-        self.rng=RandomNumberGenerator(self, self.distType)
-        self.rng.avg=mean
-        self.rng.stdev=stdev
-        self.rng.min=min
-        self.rng.max=max
+        self.rng=RandomNumberGenerator(self, **processingTime)
         self.MTTF=MTTF
         self.MTTR=MTTR
         self.availability=availability
@@ -97,7 +100,7 @@ class Machine(CoreObject):
         # define the load times
         self.loadDistType=loadDistribution 
         self.loadRng=RandomNumberGenerator(self, self.loadDistType)
-        self.loadRng.avg=loadMean
+        self.loadRng.mean=loadMean
         self.loadRng.stdev=loadStdev
         self.loadRng.min=loadMin
         self.loadRng.max=loadMax
@@ -106,7 +109,7 @@ class Machine(CoreObject):
         # define the setup times
         self.setupDistType=setupDistribution 
         self.stpRng=RandomNumberGenerator(self, self.setupDistType)
-        self.stpRng.avg=setupMean
+        self.stpRng.mean=setupMean
         self.stpRng.stdev=setupStdev
         self.stpRng.min=setupMin
         self.stpRng.max=setupMax
diff --git a/dream/simulation/OperatedMachine.py b/dream/simulation/OperatedMachine.py
index b44c2b6d1c3ba79dcb8a6e84cd320e5253195b13..7ccdea3a376b0a595619b88e22a4c5d573c6ab1a 100644
--- a/dream/simulation/OperatedMachine.py
+++ b/dream/simulation/OperatedMachine.py
@@ -80,7 +80,7 @@ class OperatedMachine(Machine):
         # define the load times
         self.loadDistType=loadDistribution 
         self.loadRng=RandomNumberGenerator(self, self.loadDistType)
-        self.loadRng.avg=loadMean
+        self.loadRng.mean=loadMean
         self.loadRng.stdev=loadStdev
         self.loadRng.min=loadMin
         self.loadRng.max=loadMax
@@ -89,7 +89,7 @@ class OperatedMachine(Machine):
         # define the setup times
         self.setupDistType=setupDistribution 
         self.stpRng=RandomNumberGenerator(self, self.setupDistType)
-        self.stpRng.avg=setupMean
+        self.stpRng.mean=setupMean
         self.stpRng.stdev=setupStdev
         self.stpRng.min=setupMin
         self.stpRng.max=setupMax
diff --git a/dream/simulation/RandomNumberGenerator.py b/dream/simulation/RandomNumberGenerator.py
index 6e396aec0a8e49dd6686a7a8ddd44a97797366a4..d9e8d39ba09ab5aa2b6e1be8fec95f27c16c7df4 100644
--- a/dream/simulation/RandomNumberGenerator.py
+++ b/dream/simulation/RandomNumberGenerator.py
@@ -26,36 +26,33 @@ Created on 14 Feb 2013
 holds methods for generations of numbers from different distributions
 '''
 class RandomNumberGenerator(object):
-    def __init__(self, obj, type):
-        self.distType=type
-        self.avg=0
-        self.stdev=0
-        self.min=0
-        self.max=0
-        #self.availability=0
-        self.alpha=0
-        self.beta=0
-        self.object=obj
+    def __init__(self, obj, distributionType, mean=0, avg=0, stdev=0, min=0, max=0, alpha=0, beta=0):
+        self.distributionType = distributionType
+        self.avg = avg
+        self.mean = mean
+        self.stdev = stdev
+        self.min = min
+        self.max = max
+        self.alpha = alpha
+        self.beta = beta
+        self.obj = obj
 
     def generateNumber(self):
         from Globals import G
-        number=0
-        if(self.distType=="Fixed"):     #if the distribution is Fixed 
-            number=self.avg
-        elif(self.distType=="Exp"):     #if the distribution is Exponential      
-            number=G.Rnd.expovariate(1.0/(self.avg))
-        elif(self.distType=="Normal"):      #if the distribution is Normal 
+        if(self.distributionType=="Fixed"):     #if the distribution is Fixed 
+            return self.mean
+        elif(self.distributionType=="Exp"):     #if the distribution is Exponential
+            return G.Rnd.expovariate(1.0/(self.avg))
+        elif(self.distributionType=="Normal"):      #if the distribution is Normal
             while 1:
                 number=G.Rnd.normalvariate(self.avg, self.stdev)
                 if number>self.max or number<self.min and max!=0:  #if the number is out of bounds repeat the process                                                                      #if max=0 this means that we did not have time "time" bounds             
                     continue
                 else:           #if the number is in the limits stop the process
-                    break           
-        elif self.distType=="Erlang":    #if the distribution is erlang          
-            number=G.Rnd.gammavariate(self.alpha,self.beta)                      
+                    return number
+        elif self.distributionType=="Erlang":    #if the distribution is erlang          
+            return G.Rnd.gammavariate(self.alpha, self.beta)
         else:
             raise ValueError("Unknown distribution %r used in %s %s" %
-                            (self.distType, self.object.type, self.object.id))
-
-        return number
+                            (self.distributionType, self.obj.__class__, self.obj.id))
 
diff --git a/dream/simulation/Source.py b/dream/simulation/Source.py
index d6d970b890fc1f97f65937c86862d8fc0d39071b..6ae2efc291fab067004626316f136b626f53ad09 100644
--- a/dream/simulation/Source.py
+++ b/dream/simulation/Source.py
@@ -41,7 +41,6 @@ class Source(CoreObject):
           interarrivalTime = {'distributionType': 'Fixed', 'mean': 1}
 
         CoreObject.__init__(self, id, name)
-        self.distType = interarrivalTime['distributionType'] # label that sets the distribution type
         # properties used for statistics
         self.totalInterArrivalTime = 0                    # the total interarrival time 
         self.numberOfArrivals = 0                         # the number of entities that were created
@@ -52,10 +51,7 @@ class Source(CoreObject):
 #                                                         # For the source it is always empty!
         self.type="Source"                              #String that shows the type of object
         
-        # XXX we could just initialize RandomNumberGenerator by passing
-        # interarrivalTime dict
-        self.rng = RandomNumberGenerator(self, self.distType)
-        self.rng.avg = interarrivalTime['mean']
+        self.rng = RandomNumberGenerator(self, **interarrivalTime)
 
         self.item=Globals.getClassFromName(item)          #the type of object that the Source will generate