what are the globals() here?
can they be avoided?