restrict variable scope, extract file path to variable