HTC One M7 - how can I upgrade on rooted device?

I have a rooted M7, with S-On and HBOOT 1.54 - Android 4.2.2. I don't really know much else since I just followed a tutorial to root it almost a year ago so I don't really know what I did.

I want to upgrade to the latest Android version (hoping it will solve the ton of issues I have with it: speaker turning on after I take a call, battery draining like hell, random things popping up like Airplane mode, CAR, not charging, randomly calling people, etc)

I tried upgrading but it doesn't work. Also tried flashing it with TWRP and doesn't work either. Can someone quickly list the steps I should take? or maybe tell me how to solve the million bugs?