Updated documentation
Added check of allocated struct before usage