wouldn't it be easier to create the ``klogp_nmklog1mp`` first and then conditionally assign to it, instead of the many and nested where