refactor: use Math.max,min instead of ternary operation
chore: use array length
refactor: 0d in 0.0 out