more formatting

improve formatting/comments and minor fixes