Improved comments; Added some nil checks