Thanks.

After some tinkering I realized why the proc. was looping but I like the clarity of your solution.