adding preloader function