Rewrite of code to match revised download script

Updates throughout code to move to a 'case' basis rather than if/then.
Also added code to extract appeal information.