Declare variable only if necessary