Self-enclosed functions in an if-statement

To prevent 
`Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function`
Error started popping up on firefox. Enclosing the function definitions does the trick. Please test.