changed strings to dynamic memory