Fixing loop to actually recur, and shortening function.