ported the arena code