changed and added some leaks