Starting to remove global vars from everywhere but main.