Refactor views with each_with_rank