yet another rewrite (after attempt to merge unsplit windows)