Modified thinfilm to replace globals with namespace-scoped variables