Adds commenting, removes unnecessary lines, fixes formatting