added more detailed grain size calculation