Moved check for homepage into dom ready callback