Optimized the computation for zone spectra.

Added error and flags.