First implementation of a window selection algorithm.