stack adapter pattern implementation and command pattern update