Updated engine code