How to treat and prevent headaches