code needs to be wrangled into functions

I have to pause but I don't want to lose these useful bash commands!!