added last if statements for correct text concatenation