add loading code