code changes to make the script honour period specified (ACE-261)