Refactoring for multilayer corner detection