refactored so beta and background_freq are saved to h5 file, background freq is only computed in one place