implementation of the command pattern