to run the whole program with main function as tool