Good working version? Need to test corner cases of n_crit