More work on main code.