fix formatting, add some comments