refactor where cors is