private RenderableBlock cloneThis(RenderableBlock rb)
    {
    	Block oriBlock = rb.getBlock();
    	oriBlock.getSockets();
    	
    	Block newBlock = new Block(workspace, rb.getGenus(), rb.blockLabel.getText());
    	RenderableBlock newRb = new RenderableBlock(workspace, parent, newBlock.getBlockID(), false);
    	
    	int i = 0;
    	Iterable<BlockConnector> oriSockets = oriBlock.getSockets();
    	Iterator<BlockConnector> newSockets = newBlock.getSockets().iterator();
    	
    	for (BlockConnector oriSocket: oriSockets)
    	{
    		BlockConnector newSocket = newSockets.next();
    		if (oriSocket.hasBlock())
    		{
    			oriSocket.getBlockID();
    			RenderableBlock subRb = workspace.getEnv().getRenderableBlock(oriSocket.getBlockID());
    			RenderableBlock newSubRb = cloneThis(subRb);
    			
    			if (newSubRb.getBlock().isFunctionBlock())
    			{
    				newSubRb.getBlock().getPlug().setConnectorBlockID(newRb.getBlockID());
    				newSocket.setConnectorBlockID(newSubRb.getBlockID());
    			}
    			if (newSubRb.getBlock().isDataBlock())
    			{
    				newSubRb.getBlock().getPlug().setConnectorBlockID(newRb.getBlockID());
    				newSocket.setConnectorBlockID(newSubRb.getBlockID());
    			}
    			if (newSubRb.getBlock().isCommandBlock())
    			{
    				newSubRb.getBlock().getBeforeConnector().setConnectorBlockID(newRb.getBlockID());
    				newSocket.setConnectorBlockID(newSubRb.getBlockID());
    			}
    			
    			
    		}
    		++i;
    	}
    	
    	if (rb.getBlock().isCommandBlock())
    	{
    		BlockConnector oriAfterConnector = rb.getBlock().getAfterConnector();
    		if (oriAfterConnector != null)
    		{
	    		if (oriAfterConnector.hasBlock())
	    		{
	    			RenderableBlock oriAfterRb = workspace.getEnv().getRenderableBlock(oriAfterConnector.getBlockID());
	    			RenderableBlock newAfterRb = cloneThis(oriAfterRb);
	    			
	    			newAfterRb.getBlock().getBeforeConnector().setConnectorBlockID(newRb.getBlockID());
	    			newRb.getBlock().getAfterConnector().setConnectorBlockID(newAfterRb.getBlockID());
	    		}
    		}
    	}
    	
    	parent.addBlock(newRb);
    	newRb.linkedDefArgsBefore = true;
    	return newRb;
    }