added and reformatted sprintf