refactor for threading

Use ///< to document.