Comverted to use sprintf rather than str concat.