My code isn't great but I think you are giving Microsoft far too much credit - they write some very bad code.