added periods variable to aror function