Fix issue #49.

Took the opportunity to refactor out some common code between the
nodes, ways and relations calls. It now matches the rails
behaviour... The rails behaviour is pretty odd, but it is what it
is and we'll match it until it's fixed.