Preparing to write ugly window functions again.