Refactor advanced detection & configuration