An exercise in data structures