More work on fixing items, removed some legacy debug code.