replaced strcpy/strcat with sprintf