added some docs, and comments