This is exactly it. I'm coming up on a year clean, and it's the only thing that has worked for me. Someone recently asked what the "secret" is to recovery. I don't think there is a secret, but here's what i said:
It's actually not a simple conversation, and there is no silver bullet, but to break it down into the most important pieces:
1) Control your thoughts
2) Deal with past hurts- do not run away from them!
3) Seek an accountability approach that works for you. (Some need software blockers, accountability partners,etc. For me, I was broken enough when I started recovery that just being here was enough)
4) Recovery must be the #1 priority in your life. Do not procrastinate. Recovery is extremely hard, and requires focused time and attention. Other things can come later when you have some stability in life.
5) Stay connected to others. Isolation and idle time breed temptation.