Move environment restriction to main entry point.