Removed ugly indata ref modifying. Replaced with a Clone pattern for pre processing.