diff --git a/codetab.ts b/codetab.ts
index a18fedd..23c5dbe 100644
--- a/codetab.ts
+++ b/codetab.ts
@@ -5,7 +5,7 @@ import { COLOR } from "./colors.ts";
 import { getCodeSheet, setSheet } from "./sheet.ts";
 import { K, ctrlKeyDown, getKeyboardString, keyPressed, shiftKeyDown } from "./keyboard.ts";
 import { clipboard, tokenize } from "./deps.ts";
-import { getContext } from "./runcode.ts";
+import { getBuiltins } from "./runcode.ts";
 import { page } from "./viewsheets.ts";
 
 const historyDebounceFrames = 20;
@@ -39,9 +39,11 @@ const state = {
 		if (this.historyIndex === this.history.length && this.historyDebounce > 0) {
 			this.snapshot();
 		}
+		console.log('historyIndex', this.historyIndex);
 		if (this.historyIndex > 0) {
 			this.historyIndex -= 1;
 			const snap = this.history[this.historyIndex];
+			console.log('historyIndex', this.historyIndex);
 			this.code = snap.code;
 			this.setSelection(snap.anchor, snap.focus);
 		}
@@ -437,18 +439,16 @@ const drawCodeField = (code: string, x: number, y: number, w: number, h: number)
 		focus,
 	} = state;
 	fillRect(x, y, w, h, COLOR.DARKERBLUE);
-	if (anchor === focus) {
-		const rect = indexToRect(code, focus);
-		fillRect(x+rect.x-scrollX, y+rect.y-scrollY, 1, rect.h+1, COLOR.YELLOW);
-	} else {
+	if (anchor !== focus) {
 		for (let i = Math.min(anchor, focus); i < Math.max(anchor, focus); i++) {
 			const sel = indexToRect(code, i);
-			fillRect(x+sel.x-scrollX, y+sel.y-scrollY, sel.w+2, sel.h+1, COLOR.WHITE);
+			fillRect(x+sel.x-scrollX, y+sel.y-scrollY, sel.w+2, sel.h, COLOR.WHITE);
 		}
-		const rect = indexToRect(code, focus);
-		fillRect(x+rect.x-scrollX, y+rect.y-scrollY, 1, rect.h+1, COLOR.YELLOW);
 	}
-	const builtins = Object.keys(getContext());
+	const rect = indexToRect(code, focus);
+	fillRect(x+rect.x-scrollX, y+rect.y-scrollY, 1, rect.h, COLOR.YELLOW);
+
+	const builtins = Object.keys(getBuiltins());
 	const tokens = [...tokenize(code)];
 	let cx = 0;
 	let cy = 0;
@@ -554,7 +554,6 @@ const update = async () => {
 	}
 	if (keyPressed(K.ARROW_UP)) {
 		const rect = indexToRect(state.code, focus);
-		console.log(rect, focus, pixelToIndex(state.code, rect.x, rect.y-1));
 		const newIndex = pixelToIndex(state.code, rect.x, rect.y-1-1);
 		if (shiftKeyDown()) {
 			state.setFocus(newIndex);
diff --git a/runcode.ts b/runcode.ts
index ecff898..3288694 100644
--- a/runcode.ts
+++ b/runcode.ts
@@ -2,8 +2,13 @@
 const G: any = {
 	eval: eval,
 };
+// deno-lint-ignore no-explicit-any
+const builtins: any = {};
 const context = new Proxy(G, {
 	get: (target, prop) => {
+		if (prop in builtins) {
+			return builtins[prop as keyof typeof builtins];
+		}
 		return target[prop];
 	},
 	set: (target, prop, value) => {
@@ -43,9 +48,9 @@ export const evalCode = (code: string) => {
 
 // deno-lint-ignore no-explicit-any
 export const addToContext = (name: string, value: any) => {
-	G[name] = value;
+	builtins[name] = value;
 }
 
-export const getContext = () => {
-	return G;
+export const getBuiltins = () => {
+	return builtins;
 }
\ No newline at end of file