Revert sample.R back to working code