cleaned up use of globals