Refactored a bit
Fixed CORS.