STORM-132 simplify code using sort-by function