Made twiddling much better, and more general; still does not work for arbitrary Prima windows, though