Fix formatting, add some more comments and improve printouts