Update engine.R