Fixed error in empty/whitespace removal function