updated script with input from Jaoa doc