refactor region growing module -- basic version