refactor region growing module -- version 2