changed ref schema
(probably) finalized ref schema, made create-reference-tree function and made put-raw-value use that instead. They're a bit narly, but for the common case there should only be one select and one insert per put-raw-value