this smells like a function that could be extracted out into a mixin if we use it in other places