Major rework of command logic