Make engine to be testable.

Have dependency inversion.