reorganizing scripts file a bit to separate page flip from history state js