Trying to fix memory leaks... still got some to go through.