finally got all the types lined up - no idea if the search algorithm is working