Implement bestfit
Changed stored order of resources