, but it still does not provide me with a sensible output in the serial monitor. I
Well you just give your code a good talking-to and tell it to shape-up and start making sense.
(That's a hint for you to tell us what you consider sensible and how that differs from what you observe)