Removed use of globals