fixed some formatting and added some comments