Refactor docs, add merge_references