rework globals a bit