Factor out remaining uneccesary global variables.