refactor controller proc