decompose code to new class engine_t