preloader added, code cleanup and simplification