Fix dependency resolving,
- use stack instead of recursion (escapes stack size error);
- check for cyclomatic dependencies.
Fix code style.
Merge pull request #61 from arthepsy/fix-dependency-resolving

Fix multiple dependency resolving flaws