Some cleanup
Need to test with dicts and probably reverse the lookup order.