FIX get rid of global state