trying to reimplement caseper with Detox guts