Added comments and removed some unused code that was commented out.