replaced .empty? with .nil?