Using pgfplot (for the first time), I try to create a chart with horizontal bars, sort of. See the figure.

I know how to do it, but because the code is quite verbose and I have lots of data I've factored out the repetitive parts in a macro called \labeledRange{beginpos}{endpos}{label}. I have also used a counter (vertposition) to get rid of manually specifying the vertical position (as I want it to increment for each range). However, the counter doesn't behave as I expect when used in a \node command in the code below. On the figure above, the labels LABEL1 and LABEL 2 should be near the blue and red bar respectively.
How can I get this to work?
(And, as a tiny other problem, how can I get rid of the 'pin' line?)
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
%\labeledRange{start}{end}{label}
\newcounter{vertposition}
\newcommand{\labeledRange}[3]{
\addplot coordinates {(#1,\arabic{vertposition}) (#2,\arabic{vertposition})};
\node[coordinate, pin=right:{#3}]
at (axis cs:#2,\arabic{vertposition}) {};
\stepcounter{vertposition}
}
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=100] %,ytick=\empty]
%using my macro -> label position is wrong
\labeledRange{10}{20}{LABEL 1}
\labeledRange{60}{70}{LABEL 2}
%without macro -> works fine
\addplot coordinates {(20,3) (50,3)};
\node[coordinate, pin=right:{LABEL 3}]
at (axis cs:50,3) {};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

