added count leading zeros and count trailing zeros in preperation for new JPS modifications