Updated function names from camelCase to underscore_delimits
Added LR 'replaces' field, minor reorg
Checks for duplicate documents