Minor fixes, add some comments