Add doctest to the engine and comments.