More global indexes updating code when window is refreshed