Refactor to use Enumerable#{count,select,find}.