Refactor discover controller

Related to #405.