diff --git a/ethereal/assets/qml/views/chain.qml b/ethereal/assets/qml/views/chain.qml
index 7ff6ffcecf8bfd2fb7698f4956eb357846214d43..2b968d56cf668980f0db491fa54b6d3fdad67708 100644
--- a/ethereal/assets/qml/views/chain.qml
+++ b/ethereal/assets/qml/views/chain.qml
@@ -145,9 +145,9 @@ Rectangle {
 				text: "Debug contract"
 				onClicked: {
 					if(tx.createsContract){
-						ui.startDbWithCode(tx.rawData)
+						eth.startDbWithCode(tx.rawData)
 					}else {
-						ui.startDbWithContractAndData(tx.address, tx.rawData)
+						eth.startDbWithContractAndData(tx.address, tx.rawData)
 					}
 				}
 			}
diff --git a/ethereal/assets/qml/views/info.qml b/ethereal/assets/qml/views/info.qml
index 96b8e4accc84b4f9425dd5e21d4e17d73298bbab..9e05e2f8e7070911fa912c296e324bf098208f2f 100644
--- a/ethereal/assets/qml/views/info.qml
+++ b/ethereal/assets/qml/views/info.qml
@@ -35,11 +35,11 @@ Rectangle {
 			text: "Client ID"
 		}
 		TextField {
-			text: eth.getCustomIdentifier()
+			text: gui.getCustomIdentifier()
 			width: 500
 			placeholderText: "Anonymous"
 			onTextChanged: {
-				eth.setCustomIdentifier(text)
+				gui.setCustomIdentifier(text)
 			}
 		}
 	}
@@ -75,7 +75,7 @@ Rectangle {
 			MouseArea{
 				anchors.fill: parent
 				onClicked: {
-					eth.registerName(nameToReg.text)
+					gui.registerName(nameToReg.text)
 					nameToReg.text = ""
 				}
 			}
@@ -107,7 +107,7 @@ Rectangle {
 
 		Slider {
 			id: logLevelSlider
-			value: eth.getLogLevelInt()
+			value: gui.getLogLevelInt()
 			anchors {
 				right: parent.right
 				top: parent.top
@@ -124,7 +124,7 @@ Rectangle {
 			stepSize: 1
 
 			onValueChanged: {
-				eth.setLogLevel(value)
+				gui.setLogLevel(value)
 			}
 		}
 	}
diff --git a/ethereal/assets/qml/views/transaction.qml b/ethereal/assets/qml/views/transaction.qml
index 4ede9e10b244877afbd458a942752069e7b3ac40..61a1b81cd92579da0d7ebc0cf53dfee237ff1817 100644
--- a/ethereal/assets/qml/views/transaction.qml
+++ b/ethereal/assets/qml/views/transaction.qml
@@ -174,7 +174,7 @@ Rectangle {
 			onClicked: {
 				var value = txValue.text + denomModel.get(valueDenom.currentIndex).zeros;
 				var gasPrice = txGasPrice.text + denomModel.get(gasDenom.currentIndex).zeros;
-				var res = eth.create(txFuelRecipient.text, value, txGas.text, gasPrice, codeView.text)
+				var res = gui.create(txFuelRecipient.text, value, txGas.text, gasPrice, codeView.text)
 				if(res[1]) {
 					txResult.text = "Your contract <b>could not</b> be sent over the network:\n<b>"
 					txResult.text += res[1].error()
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index b3fda0a58451fd78f407e993b15342181478e8d7..10cbe5c1e3e6f172b1ac1bdb95fa5ca1a7780d80 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -26,7 +26,7 @@ ApplicationWindow {
 		var pendingTxView = addPlugin("./views/pending_tx.qml")
 
 		// Call the ready handler
-		eth.done()
+		gui.done()
 	}
 
 	function addPlugin(path, options) {
@@ -111,7 +111,7 @@ ApplicationWindow {
 				text: "Run JS file"
 				onTriggered: {
 					generalFileDialog.callback = function(path) {
-						eth.evalJavascriptFile(path)
+						lib.evalJavascriptFile(path)
 					}
 					generalFileDialog.open()
 				}
@@ -155,7 +155,7 @@ ApplicationWindow {
 				id: miningButton
 				text: "Start Mining"
 				onClicked: {
-					eth.toggleMining()
+					gui.toggleMining()
 				}
 			}
 
@@ -456,7 +456,7 @@ ApplicationWindow {
 			anchors.leftMargin: 5
 			text: "Import"
 			onClicked: {
-				eth.importTx(txImportField.text)
+				lib.importTx(txImportField.text)
 				txImportField.visible = false
 			}
 		}
diff --git a/ethereal/gui.go b/ethereal/gui.go
index d8ab50ac691e4c1fa5c4d5602bf6ec853e4236f7..e0a415201cff17aa82aa9d2dae87360ec96bafd3 100644
--- a/ethereal/gui.go
+++ b/ethereal/gui.go
@@ -18,7 +18,6 @@ import (
 	"github.com/ethereum/eth-go/ethreact"
 	"github.com/ethereum/eth-go/ethutil"
 	"github.com/ethereum/eth-go/ethwire"
-	"github.com/ethereum/go-ethereum/javascript"
 	"github.com/ethereum/go-ethereum/utils"
 	"github.com/go-qml/qml"
 )
@@ -49,8 +48,6 @@ type Gui struct {
 	config         *ethutil.ConfigManager
 
 	miner *ethminer.Miner
-
-	jsEngine *javascript.JSRE
 }
 
 // Create GUI, but doesn't start it
@@ -62,7 +59,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
 
 	pub := ethpub.NewPEthereum(ethereum)
 
-	return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, jsEngine: javascript.NewJSRE(ethereum)}
+	return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config}
 }
 
 func (gui *Gui) Start(assetPath string) {
@@ -81,12 +78,12 @@ func (gui *Gui) Start(assetPath string) {
 	// Create a new QML engine
 	gui.engine = qml.NewEngine()
 	context := gui.engine.Context()
+	gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
 
 	// Expose the eth library and the ui library to QML
-	context.SetVar("eth", gui)
+	context.SetVar("gui", gui)
 	context.SetVar("pub", gui.pub)
-	gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
-	context.SetVar("ui", gui.uiLib)
+	context.SetVar("eth", gui.uiLib)
 
 	// Load the main QML interface
 	data, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
@@ -126,7 +123,7 @@ func (gui *Gui) Stop() {
 		gui.win.Hide()
 	}
 
-	gui.jsEngine.Stop()
+	gui.uiLib.jsEngine.Stop()
 
 	logger.Infoln("Stopped")
 }
@@ -477,18 +474,6 @@ func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PR
 	return gui.pub.Transact(gui.privateKey(), recipient, value, gas, gasPrice, data)
 }
 
-func (self *Gui) ImportTx(rlpTx string) {
-	tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
-	self.eth.TxPool().QueueTransaction(tx)
-}
-
-func (self *Gui) SearchChange(blockHash, address, storageAddress string) {
-}
-
-func (self *Gui) EvalJavascriptFile(path string) {
-	self.jsEngine.LoadExtFile(path[7:])
-}
-
 func (gui *Gui) SetCustomIdentifier(customIdentifier string) {
 	gui.clientIdentity.SetCustomIdentifier(customIdentifier)
 	gui.config.Save("id", customIdentifier)
diff --git a/ethereal/ui_lib.go b/ethereal/ui_lib.go
index 42c5c9ad2dd0dda8d5621ab382f9bf1b6d8d6569..1d9085fcb14fd05e2b2e35fbc97a82e2fafa9805 100644
--- a/ethereal/ui_lib.go
+++ b/ethereal/ui_lib.go
@@ -4,7 +4,9 @@ import (
 	"path"
 
 	"github.com/ethereum/eth-go"
+	"github.com/ethereum/eth-go/ethchain"
 	"github.com/ethereum/eth-go/ethutil"
+	"github.com/ethereum/go-ethereum/javascript"
 	"github.com/go-qml/qml"
 )
 
@@ -23,10 +25,21 @@ type UiLib struct {
 	win      *qml.Window
 	Db       *Debugger
 	DbWindow *DebuggerWindow
+
+	jsEngine *javascript.JSRE
 }
 
 func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
-	return &UiLib{engine: engine, eth: eth, assetPath: assetPath}
+	return &UiLib{engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth)}
+}
+
+func (self *UiLib) ImportTx(rlpTx string) {
+	tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
+	self.eth.TxPool().QueueTransaction(tx)
+}
+
+func (self *UiLib) EvalJavascriptFile(path string) {
+	self.jsEngine.LoadExtFile(path[7:])
 }
 
 func (ui *UiLib) OpenQml(path string) {