move progress_elem closer to function