Mock only if on RTD.

   And some code cleanup.