Replaced setf's by maximizing and minimizing statements in loops