Use closures for objects to limit variables scope to local instead of
global.