MISRA C 2012 Work

Adjusted for brace requirements and other minor formatting.