(#3262) - Minor style fixes

Inlined some unnecessary function calls, extraced some re-used logic,
indented a few things.
^ in this codebase we usually don't put the if/returns on the same line