function declaration moved in guard block

wtf?
Merge pull request #4 from Maxwe11/patch-1

function declaration moved in guard block