Add a helper function so we don't need to constantly repeat ourselves.
Hopefully, this'll make this code a bit easier to approach.