Small refactor
Move creation of variable to where it's needed