It works but there is still some duplication
It works -- now need to refactor, maybe add Arel for speed
It works, got rid of duplication the right way -- need to make faster with arel