Fix some syntaxical nonsense.

Function doesn't need to be in variables and nested if is unnecessary if there is no alternative.
Merge pull request #1 from brnrd/patch-1

Fix some syntax stuff