main program written.