community detection and refactored fischer's test