a little smarter fitAll algorithm