Update copyright
Remove unused variables
Fix pointer check.
Remove C++ comments
Move variable declaration