updated periodicity scoring algorithm