I stopped reading this method - it looks very similar to a couple of other ```_CIM_extract``` implementations in this module and the alarm bells are ringing. Any factorisation which you can see here?