Replace whitespace search string with a constant

And use a local variable as oppose to calling the same method over and over.

Sorry about the indentation...

Fixes #16