prep for max_data
to global variable and simple stack