Tweaks to functions; set up script for period-based analysis of contexts and samples