added loader toggle function