some bugs and memory leaks removed, README edited