I asked a couple of questions recently on StackOverflow to see if I could consolidate some functions into one by making use of templates. Those questions were: