refactor
diff --git a/onos-build-vm.py b/onos-build-vm.py
index 4c20e98..e54041d 100755
--- a/onos-build-vm.py
+++ b/onos-build-vm.py
@@ -31,15 +31,13 @@
     vm.sendline( 'bash vm-setup-lxc.sh' )
     vm.expect( prompt, timeout=3600 )
 
-    """
-    vm.sendline('sudo su - tutorial1')
+    
+    vm.sendline('sudo su - mininet')
     vm.expect(prompt, timeout=20) 
-    vm.sendline( 'git clone https://gerrit.onosproject.org/onos' )
-    vm.expect( prompt, timeout=30 )
-    vm.sendline( 'cd onos && git checkout %s && cd -' % onos_version )
-
-
-    vm.expect( prompt, timeout=1200 )
+    #vm.sendline( 'git clone https://gerrit.onosproject.org/onos' )
+    #vm.expect( prompt, timeout=30 )
+    #vm.sendline( 'cd onos && git checkout %s && cd -' % onos_version )
+    #vm.expect( prompt, timeout=1200 )
   
      
     vm.sendline('ssh 127.0.0.1')
@@ -50,14 +48,14 @@
     
     vm.expect( prompt, timeout=1200 )
    
-    url = 'https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=onos-setup.sh'
-    vm.sendline( ' wget -O onos-setup.sh "%s" | bash' % url ) # space prefix is used to avoid entry in history
+    url = 'https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=onos-setup-lxc.sh'
+    vm.sendline( ' wget -O onos-setup-lxc.sh "%s" | bash' % url ) # space prefix is used to avoid entry in history
     vm.expect( prompt, timeout=20 )
-    vm.sendline( 'bash onos-setup.sh' )
+    vm.sendline( 'bash onos-setup-lxc.sh' )
     vm.expect(prompt, timeout=3600)
     vm.sendline('exit')
     vm.expect(prompt, timeout=20) 
-    """
+    
     
 
 def vmdk2size( vmdk ):
diff --git a/onos-setup-lxc.sh b/onos-setup-lxc.sh
new file mode 100644
index 0000000..c4c87fb
--- /dev/null
+++ b/onos-setup-lxc.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# onos-setup-lxc.sh
+#  
+# This script sets up the VM ready to run ONOS and tutorials, including installing an LXC cluster
+# for ONOS to run in.
+
+# -------------- Install ONOS ----------------
+
+USER=mininet
+USER_HOME=/home/${USER}
+
+echo `whoami`
+
+cd ~
+git clone https://gerrit.onosproject.org/onos
+cd onos && git checkout 1.1.0 && cd -
+
+#echo "export ONOS_ROOT=${USER_HOME}/onos" >> ~/.bashrc
+#echo ". ~/onos/tools/dev/bash_profile" >> ~/.bashrc
+
+export ONOS_ROOT=${USER_HOME}/onos
+. ~/onos/tools/dev/bash_profile
+
+echo $ONOS_ROOT
+
+echo $JAVA_HOME
+export JAVA_HOME=""
+cd $ONOS_ROOT && mvn clean install && mvn dependency:go-offline && cd -
+
+cat << EOF >> onos/tools/test/cells/tutorial
+export ONOS_NIC=10.0.3.*
+export OC1="10.0.3.11"
+export OC1="10.0.3.12"
+export OC1="10.0.3.13"
+export OCI="${OC1}"
+export ONOS_FEATURES="webconsole,onos-rest,onos-gui,onos-api,onos-core,onos-cli,onos-openflow"
+export ONOS_USER="sdn"
+EOF
+
+cell tutorial
+
+onos-package
+onos-group install -f
+onos-wait-for-start $OC1
+onos-wait-for-start $OC2
+onos-wait-for-start $OC3
+
+sleep 20
+onos 1 "nodes"
diff --git a/vm-setup-lxc.sh b/vm-setup-lxc.sh
index 86ddb38..848f654 100644
--- a/vm-setup-lxc.sh
+++ b/vm-setup-lxc.sh
@@ -65,50 +65,3 @@
 sleep 5
 
 sudo lxc-ls --fancy
-
-# -------------- Install ONOS ----------------
-
-USER=mininet
-USER_HOME=/home/${USER}
-
-echo "hello"
-sudo su - ${USER}
-echo "chusr"
-echo `whoami`
-
-cd ~
-git clone https://gerrit.onosproject.org/onos
-cd onos && git checkout 1.1.0 && cd -
-
-echo ". ~/onos/tools/dev/bash_profile" >> ~/.bashrc
-echo "export ONOS_ROOT=${USER_HOME}/onos" >> ~/.bashrc
-
-exit
-sudo su - ${USER}
-
-echo $JAVA_HOME
-export JAVA_HOME=""
-cd $ONOS_ROOT && mvn clean install && mvn dependency:go-offline && cd -
-
-cat << EOF >> onos/tools/test/cells/tutorial
-export ONOS_NIC=10.0.3.*
-export OC1="10.0.3.11"
-export OC1="10.0.3.12"
-export OC1="10.0.3.13"
-export OCI="${OC1}"
-export ONOS_FEATURES="webconsole,onos-rest,onos-gui,onos-api,onos-core,onos-cli,onos-openflow"
-export ONOS_USER="sdn"
-EOF
-
-cell tutorial
-
-onos-package
-onos-group install -f
-onos-wait-for-start $OC1
-onos-wait-for-start $OC2
-onos-wait-for-start $OC3
-
-sleep 20
-onos 1 "nodes"
-
-exit
\ No newline at end of file