Refactoring 2
Rewrite clusterization
Fix memory leaks
Add module support