added variable declaration and ref