Move periods script to periods.js