clean up code.

I just adjusted some branch structures to make code look cleaner.