coding standard fixes

Fixes for coding standards (spacing, whitespace, etc.) as well as escaping/sanitization fixes.