refactors cors methods a bit