Converted to the command pattern.