clean up some useless stuff and correctly refocus the repl
fix max/min problems