Created nextFit function