Fix + improved sample calc