Fixed up some formatting and added some useful comments