Labeled global vars, removed obselete comments and changed to local text_palette.