I updated the function above... see if that works any better.