Refactor the ref filtering functionality out of the getRef() function.
Write simple getLocalRef(), and use it in getRef() first.
Beef up the early localref handling, and remove local ref handling from the rest of getRef().
Add a section to the README about dealing with fatal errors.