Added exception handling in the Command