Fix bunch of potential NPEs. Added some comments. Fixed typos.
Now that the library can be started without an Activity/Context, care has to be taken so it doesn't attempt to use a null context.