added two new variables and a neighboring image preloading strategy