structure improvements + cosmetics

 * split resources in classes
 * use chaining feature to manage dependencies and relationships
switching this module to Apache license
Merge pull request #5 from mbornoz/refactoring

Refactoring