added some better error handling on commands