some cleanup with Ben's solution