Abstracted body parsing code into function