Add read_histories function.