implemented jit and some otimizations.