changed json decodes to only on 200 codes, change case for function