Just organizing.

I realize that I started this long ago, and the objectives changed
  along the time. I need to redefine the objectives here and do some
  refactoring.
Cosmetic cleaning.
Minor bugfix, dirname instead of relpath