Added some commentary, cleaned up indentation