fixing some bugs
fixed spelling
handle malloc incase null
removed excess spaces