Add coherence, fix some bugs