modified to use Typesafe Stack