Refactored "/control" routine