completes implementation of fit-grains