Implemented the command pattern.