1) autodetermine optimal algorithm
2) several errors fixed
3) memory allocation optimization
4) general optimizations after profiling