added the grain class
merged in master