fix memory leaks, cleanup
cleanup
optimized params