put code into a main function