Added check for dates outside range; split prep and analysis scripts up