algorithm for candidate regions