Changed format string calculation with a loop counter so that we can just generate the string properly the first time, rather than generating a string and then trimming it with the strings library.