main routine written