Helper functions for QUASIEXPAND