Added pointer casts to remove known-safe use of generic queue and list datastructures.