looks like this should be replaced by a `foreach` loop