Main loop works in emscripten