Implementation of Command pattern