Remove whitespace
Fix test method shadowing
Clean up warnings
Reogranize conditional to reduce mental strain

Swapping the if condition and using an elsif leads to more
understandable code due to less nesting.