Removed backslash before &
Replaced loop which could cause infinite loop with if. Removes one leading and trailing whitespace instead of all