Changed loading code for asynchronous loading