improve code layout and indention

This doesn't change the functionality, only remove some possible
ambiguities.
improve code layout and indention