Updated documentation and commenting in the code.