Plugged potential leaks, deleted unused files