Added exception handling to commands.