Also updated data structures and reconfigure. Known bug: the hash doesn't take adata into account. Needs fixing!