the final allegro of bwv 1017 is a spirited dance-like "tutti fugue" in binary form. like the last movements of bwv 1014 and the first organ sonata bwv 525, it follows the same plan as the fugal gigues in bach's keyboard partitas, bwv 825–830; namely in the second part of the binary movement, the fugue subject is inverted.