refactored for simpler workflow