Function to replace repeated code

I learned what functions are, because repeating code over and over is
gross.