Started refactoring ingest and scratchpad.