Moved code to initi during dom ready