Unified ncoh and coh computations into a single function