few memory leaks fixed
dependency-based build