Much faster flattening, janky trial calculations