Wrap script in a main() function