The main entry point takes a global environment as argument.