More work on main script.