XML documents are much like humans — they are cute and fun to deal with when they’re small but can get really annoying as they grow bigger.
When you come across a stumbling block because the code doesn't quite fit anymore, or you notice two things that should really be merged, or anything else at all strikes you as being "wrong", don't hesitate to change it. There's no time like the present.
Write shy code - modules that don't reveal anything unnecessary to other modules and that don't rely on other modules' implementations.
It's not at all important to get it right the first time. It's vitally important to get it right the last time.
Be careful to preserve the orthogonality of your system as you introduce third-party toolkits and libraries. Choose your technologies wisely.
DRY ‐ Don't Repeat Yourself ‐ Every piece of knowledge must have a single, unambiguous, athoritative representation within a system.
Source code available @ githubpull requests are more than welcome ;-)