improvements to style, did some commenting