Bug fixes + added ceil option and trailing_zeros parameter