Finished cleaning and commenting code.