Refactored GrainUtils a bit.

Signed-off-by: Dmitriy Pavlenko <dmitriy.pavlenko@sysgears.com>
Merge branch 'master' of github.com:sysgears/grain