Refactor grains