Some fixes to get the snippet code working.