moved vars to top