Improved the CORS handler in the service