minor tidying up, and beginning to move centralised functions into cdr
Merge branch 'feature/cors'