Still more type fixes.
Remove a bunch of global vars.
Fix build up to io.go.