container.directory: filtering optimizations

local variables have a better access time