Refactored sequence to use cond