WIP: add resampling & var based thresh