better implementation of the command execute