code refactor in engine