Moving var inside func