Use cors and refactor.