Breaking negative thought patterns could ward off anxiety, depression