refactorin + cors