optimizing load time and ping function