Adds additional check for null refs
Adds documentation