Upgraded space finding algorithm.