grant permits script final