-Fixed some resource leaks
-Added some documentation