functions for primary decomposition