Refactoring detectors and fix #20