Remove unused global variables and defines