Fixed #5: Added dependency sorting

Added sorting by module depdencies
Added related example
Improved error reporting