refactors fitgrains