Cleaned up a loop so that it works in my version of Chrome.