memory leaks fixed, benchmark added