Declare variable only if needed.