MISRA C 2012 Compliance work

Altered to meet brace requirements, trailing else following else if and
explicit returns for void functions.