Put script into a main function