Added function to initialize scripts once all windows have loaded