Add more error checking to commands