A few things that will help you get the best experience possible. Not all phones are created equal tho.
This is what I did myself on my M8, and what is recommended for most people. Found out that I had to wipe cache partition after the factory reset since my phone was a little wonky.
Simply follow the instructions HERE. It will of course take a while to setup your phone again, but it’s so worth it.
Wipe Cache Partition
Simply follow the instructions HERE. This step will not remove any personal content on your phone, it will merely make sure that the environment on your phone is as nice and clean as possible.