Document and try to order part of ```DboSource```.

To be able to fix #2268, I begun documenting and trying to order part of ```DboSource```. Because most of the commits depend on the previous ones, issuing a PR for every one and trying to keep it isolated from the others is a bit tricky, but I'll try to do it whenever I can.

Every commit is explained, but what I did here can be summed up in this items:

* Be more semantic with some variable names.
* Avoid recalculating variables inside loops if possible.
* Process variables only when needed.
* Document hacks, crazy code, etc.