Make all imports explicit relative imports.  Clean up namespace in refs.py.