Documentation

I added some documentation and comments.