updated to @mwmiller's suggested cleanup