updated per @adamedx comments