residuals.orm: put in namespace and added examples from Qi Liu