That's some really, really good introspection right there.
One of the positives that can come out of the intense pain of these situations is the self-analysis and self-growth, if you will seek it. Sounds like you are well on your way.
Kudos for having the 'nad to face up to your faults.