Added CORS headers, moved generateId() to the correct file