Refactor detection to OOP #2