Make a big function a little smaller