started to port some reference parsing routines

looking sensible to you so far?