corrected computation of z waves
refactored test class