memory usage tuning and added statistics