Moved resource vars to top of script