works with real programs (finally with main method)