fianl modification of main