Fixing things, going to fix the leaks and add comments