Migrating NaCl to remove global variables