Small typo fix.
Other code cleanup and syntax fixing.