turd refactor per @cowboy