a simple command pattern implementation