Initial work on main routine