impl and tests of simplestack