Move more engine-specific stuff out of main .js