Remove use of given/when and fix closures
1.32.1