use .empty? instead of length == 0