Refactor step categorizing medications by class.