adding doc comments, fixing style