switch to using .empty? instead of str != ""