Changed zero counting method to use mean instead of numerical zero as a sign change reference.