updated string manip logic