implementing s2n min