Fixed survey bug, highlighted by the smoke tests.
Cleanup, modernise