Added some documentation and fixed a nullpointer exception.