move some datastructures into the relevant modules