Refactored the command building to be more simple.