Added summary for some methods and classes.
Added some checks to prevent NullReferenceException occured in #22

Hopefully fixed #22

Also added summaries for some methods.