You've made the first step. The key thing you need to ask yourself right now is not how to get your W back, but what kind of person to become. Do not tell your W that you are going to change ... you have to show her.
I would suggest that you read: Winning Your Wife Back Before It's Too Late by Gary Smalley. The book is written from a Christian perspective, and I don't know what faith, if any, you have; but I feel sure that you'll get a lot out of it. You can get it from most large bookstores or used on Amazon for $3.89, so don't wait.
The LORD is near to all who call on him, to all who call on him in truth." (Psalm 145:18)