Added code for index creation of stats tables
Hardened security of the multisite cookie
Removed remaining reference to school_info['type'] because is no longer used