Mods to On-the-fly sample duration code (WiP)